I having a frunctionality in which user can select multiple product links and can choose an option to mail those links to anyone as a new outlook mail window will be opened. Everything is working fine on my local machine but on deployed link this functionality is not working and is throwing below exception:
Exception Message : System.Runtime.InteropServices.COMException
(0x80010001): Retrieving the COM class factory for component with
CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the
following error: 80010001 Call was rejected by callee. (Exception from
HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).
I saw a couple of solutions for this like this and some code samples here but nothing helped me.
Also before going for the c# code for opening new mail window, i also tried doing it in javascript but got an issue there as well (here).
Please help !!
See sending mail through outlook is not done by server side it should be done in client Side..
To open a link in mail sending client you can do
Send Mail
This will automatically open mail sending client in user machine
Related
I know there are other similar questions, but none of the answers helped me.
I have an ASP.NET web application hosted in IIS on a server.
The server has a windows operating system with a windows user name, suppose: ServerDomain/ServerUserName.
I have a Main.aspx page. The page has a link tag:
Resend
The page has a script tag and there I have a Java Script function:
function resendHandle(el) {
var clientWindowsName = ?
alert(clientWindowsName );
setCurrentUser(clientWindowsName));
submit();
}
Now suppose a client, who also has a windows operating system with a Windows user name: ClientXDomain/ClientXUserName is browsing my site.
Once he clicks the Resend link, the control flows to resendHandle Java Script function and after "submit" to the Resend method in Main.aspx.cs (behind code file). In this method, I want to retrieve the client windows user name, which is: ClientXDomain/ClientXUserName. Obviously, the aspx.cs is a server code, so if I check there for user identity in this method, I will get: ServerDomain/ServerUserName. But as I've mentioned, I want to get the: ClientXDomain/ClientXUserName in this method.
The clientWindowsName is accessed from the server method with the help of setCurrentUser, so there is no problem for me to transfer the clientWindowsName variable value (within the resendHandle java script function) to the server size.
The problem is that
alert(clientWindowsName );
always returns NULL for me for:
var clientWindowsName = '<%=Page.User.Identity.Name%>';
and for other options I've tried.
Only for:
var clientWindowsName = '<%=Request.LogonUserIdentity.Name.ToString()%>';
it alerts NT AUTHORITYIUSR.
but none of the options gives me the desired user name: ClientXDomain/ClientXUserName.
So, how do I get it? Note that I'm trying to get the value within a Java Script function, maybe I should try to do outside the script tag. Thanks!
EDIT 01: My web config contains:
<authentication mode="Windows"/>
Enable impersonation which will help you to get loggined user identity .
in web.config or it can be set on IIS server please check how to set it .But this is what you are missing .
<identity impersonate="true" />
Hi you need to set impersonation as well this way if user is in active directory then his identity can be passed to code otherwise you will get the identity on account under which it is hosted under IIS.
https://msdn.microsoft.com/en-us/library/aa292118(v=vs.71).aspx
I think you need to configure your website using WIndows Authentication instead of Form authentication, like this https://www.codeproject.com/Articles/94612/Windows-Authentication
I had to disable Anonymous Authentication.
I'have created websocket like this:
Create "Hello World" WebSocket example
I have a problem because server doesn't send message to Client and in JS script function onmessage() is never fired. The connection is closed right after second send() on server is fired or after while. Do you know how to fix it? There is no respectable documentation for websockets and I couldn't find right answer why it doesn't work. Thanks for all answers.
#edit
There is an error after sending second message.
An error: An established connection was aborted by the software in your host.
There is also an error in javascript. When the second message is sending I get an error: Invalid frame header.
I have no idea why the first message with header works but the second with data doesn't.
I solved it. When u use socket server and websocket client you have to create your own frame for sending data back to client and it works fine.
I'm wondering if it's possible to, say, open up a jsfiddle on a random computer and log in and authenticate and use the drive API, without having to have a local server running all the time? And how exactly does one go about setting this up? I'm sorry if this is a simple question but I'm just sorta lost because the instructions that I've found so far are unclear.
Edit:
So far I have, following from here and here:
Created a project via the Google Developers Console.
Opened up that project there, navigated to APIs under APIs & auth, and ensured that Drive API was enabled
Went into credentials, and clicked on "Create a new Client ID"
Selected "Web Application"
Set authorized javascript origins to http://localhost:4567
Deleted any contents in Redirect URI's and left it blank, then pressed "Create Client ID."
Took a sample like this, this, or this, and stored it in a local file named named index.html.
This wouldn't run by simply opening in a brower, so I had to host a local server
I navigated into that directory in the command line and then typed "python -m SimpleHTTPServer 4567" (without the quotes) and this hosted a local server
Opened http://localhost:4567 in my web brower, and all of these samples work fine, after copying the newly created client ID into these files where they ask for it.
I also have made a python application, to use pydrive I:
Clicked on "Create a new Client ID", then "Installed Application" and "Other", then "Create Client ID."
Next I went to the Old Google APIs Console, clicked on API Access, found that client ID, and clicked Download JSON.
I placed this client_secrets.json next to my python application, and this allowed pydrive to authenticate successfully and I could access and modify my google drive files anywhere using that client ID. Though of course I deleted this client_secrets.json before giving the application to another person, and showed them how to do this process as well.
However, beyond this, I'm a little unsure about, specifically:
How one can use the drive api in web applications without having to set up a local server, say simply by running code in jsfiddle and having requests sent through my project via using a Client ID, and
If a local server is set up that can be accessed by anyone on the web, how one can modify the above steps to allow any client to open that server's webpage to use the google drive API?
I know that I most likely need to set up a Public API access in the developers console, but am not entirely sure what Referers I should use as well. So is there a simple way to do any of this?
I also know that gspread can open google excell spreadsheets only using the client's username and password, so I'm suspecting that what I'm looking for is possible, but I'm not sure.
Okay, so I found a solution that works pretty well:
Make an OAuth.io account (It's free).
Once you're logged in, go to your oauth.io dashboard.
You should be looking at a Default App, or you can make another one it doesn't really matter.
Under "Domains & URLs whitelist", you'll see a little box that says "localhost." Type in "
http://fiddle.jshell.net/" (without the quotes) and press enter. This allows any jsfiddle to authenticate with your application
Next, we need to enable Google Drive support
Go to the Google Developers Console
Like before, navigate to Credentials under APIs and Auth.
Click "Create new Client ID"
Select Web Application
Under "Redirect URIs" put "https://oauth.io/auth" and "http://oauth.io/auth" (without quotes, on separate lines)
Under "Javascript Origins" put "https://oauth.io" and "http://oauth.io"
Press "Create Client ID"
Now go to your Oauth.io key manager. Click on Google Drive in the list to the left. Press next, and enter your client_id and client_secret that you created in the previous step (via the Google Developers Console)
Select online (at least online is preferred since offline should be for server side only)
Click on the Scope text book, and select "https://www.googleapis.com/auth/drive (View and manage the files in your google Drive)."
Press finish. Now click on the Try Auth button, and hopefully you should get some output like
{
"access_token": "ya29.AwH-1N_gnstLBuZfOR4W9CCcggKrQpMyKYV4QVEtCiIzHozNU5AfUJoYQzukALfjdiw2iOCUve7JbQ",
"token_type": "Bearer",
"expires_in": 3600,
"provider": "google_drive"
}
To use this, you can do something like:
// This only works because we're set to "No wrap - in <head>"
function ShowDriveFileList() {
var accessToken;
// Initialize OAuth with our key
OAuth.initialize('lmGlb8BaftfF4Y5en_c8XYOSq2A');
// Connect to google drive, and print out file list
OAuth.popup('google_drive').done(function (result) {
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "https://www.googleapis.com/drive/v2/files", false);
xmlHttp.setRequestHeader("Authorization", "Bearer " + result.access_token);
xmlHttp.send(null);
alert(xmlHttp.responseText);
}).fail(function (err) {
alert(err);
});;
}
Which you can find at http://jsfiddle.net/JMTVz/41/. This uses my oauth.io client id, but you can replace it with yours and it should work as well.
You can do the same thing using the OAuth Playground.
See How do I authorise an app (web or installed) without user intervention? (canonical ?)
Step 11 will be different. Instead of pasting the refresh token into your server app (which you don't have), you'll paste the access token into your JS in the same way as you are doing in your answer.
I am totally new to braintree and was just trying out the tutorial (javascript for client and JAVA on the server side)
I created a simple HTML file basically just wrapping the "Hello Client" example. I had also tried using both the given clientToken provided in the example and one I obtained from the sandbox account.
However, after I filled out a valid credit information and tried to submit the form, I've got this error:
"There was an error processing your request. Try again"
And this error occurred BEFORE the form submission was actually sent to the server; braintree.js seems to have intercepted the submission and did some authorization with its server, and thats where the error above came from
I looked at the chrome developer console and saw the requests were like this:
Request URL:https://client-analytics.sandbox.braintreegateway.com
Params:
authorizationFingerprint: [some fp]
sharedCustomerIdentifierType:undefined
analytics[][kind]:dropin.web.inline.add-card.fail
_meta[platform]:web
_meta[platformVersion]: [some value]
_meta[integrationType]:dropin
_meta[sdkVersion]:braintree/web/2.3.3
_meta[merchantAppId]:file:///Users/jiayaohan/Desktop/card.html
braintreeLibraryVersion:braintree/web/2.3.3
_method:POST
callback:callback_json9
And the status code itself was OK (200), but in the response, the content was:
callback_json9({status:201})
Anyone knows what might go wrong with this very simple hello-world client setup? (noted that I've tried using both the given example client Token and one derived from my own sandbox account, but the same error happened)
Thanks!
I work at Braintree.
It looks like there was a failure adding a card. Are you using the available testing card credentials?
Sandbox only accepts certain test numbers, so that could be your issue. The most commonly used test number is 4111111111111111.
I am getting an error when I use JavaScript remoting and have my URLReWriter turned on on my Force.com SIte. The error does not occur when using JavaScript Remoting with the URL ReWriter turned off.
The error is as follows
Exception Error parsing json response: 'Unexpected token <'. Logged in?
I'm confused as to why this is occuring. If I have no checks for being logged in in my URL ReWriter (or visualforce page) why should this occur?
Has anyone ever come across something similar to this before? I noted the following https://salesforce.stackexchange.com/questions/4112/possible-oauth-remote-action-bug but in my case I am not using authentication on my site for the test page that I created & I'm wondering why it mentions "login".
Is it possible that URLRewriters and JavaScript Remoting currently do not work together in general?
Thanks in advance for any help on this.
Can you try debugging it server side? Add "your_site_name Guest User" to the debug logs and try the action. If you're lucky you'll see something going wrong (in the remote action? in rewriter?) and I suspect this uncaught problem causes a redirect to maintenance page (which will be HTML, not JSON)...
If not - use Firebug or similar tool to inspect request & response in detail? Or event.status?
Can it be something related to permissions? http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting.htm Or if you're returning html - I think you should have {escape:true}?
Does it happen in any browser? Maybe something doesn't like redirects caused by the URL rewriter. I've seen cases (not with Salesforce though) that antivirus software sometimes was adding some strange javascript at the end of certain websites and they had to be whitelisted...
The error may also happen due to parser error when page recieves status message from remote action function.
For example i tried Remote Action with attachment
#RemoteAction
public attachment attach(String body){
attachment a=new attachment();
a.body=body;
a.name='a.png'
insert a;
return a;
}
On the above code i receive error since SFDC does not parse the attachment object.SO if there are parser errors we get this message .
As a workaround i send as a wrapper .Hence i would suggest to investigate the return parameter of remote action and also wrapping it as workaround .
Hope this helps