Answered by:
CRM Online: How to pass user credentials to webrequest?

Question
-
Hi,
i want to invoke a .aspx webpage from microsoft dynamics online by an selfmade c# application and then read the hmtl content. How i can pass the user credentials to the web request? Currently i got the default "not logged in" message.
My Url:
"https://DOMAIN/dashboards/dashboard.aspx?dashboardid=%7bee50a18b-3f88-df11-8d93-00155db1891a%7d&dashboardType=1030&pagemode=iframe#";
Ill try something like this:
Uri uri = new Uri(url);
WebRequest http = HttpWebRequest.Create(url);
http.Credentials = new NetworkCredential("user", "password");
http.PreAuthenticate = true;
HttpWebResponse response = (HttpWebResponse)http.GetResponse();
Stream stream = response.GetResponseStream();Wednesday, April 4, 2012 12:03 PM
Answers
-
Since you are talking about CRM Online you will be dealing with Windows Live auth. You will want to look at the sdk and specifically the code behind the plugin registration tool and/or the SOAP Logger solution in /sdk/samplecode/cs/client. The system connects to CRM Online in both of those solutions.
Jamie Miley
Check out my about.me profile!
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Wednesday, April 4, 2012 5:17 PM
- Marked as answer by Jamie MileyModerator Thursday, March 7, 2013 7:25 PM
Wednesday, April 4, 2012 5:17 PMModerator -
Those SOAP services or an app through an Iframe (using cross frame scripting) would be the only ways to use the api.
In the jscript cross frame scripting scenario you have to enable cross-frame scripting in the iframe properties for the specific iframe.
If you are talking about anything else besides using the SOAP services provided or using the Xrm.Page api on the client side you are looking at a solution that would be unsupported.
Jamie Miley
Check out my about.me profile!
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Thursday, April 5, 2012 9:35 PM
- Marked as answer by Jamie MileyModerator Thursday, March 7, 2013 7:25 PM
Thursday, April 5, 2012 9:35 PMModerator
All replies
-
Since you are talking about CRM Online you will be dealing with Windows Live auth. You will want to look at the sdk and specifically the code behind the plugin registration tool and/or the SOAP Logger solution in /sdk/samplecode/cs/client. The system connects to CRM Online in both of those solutions.
Jamie Miley
Check out my about.me profile!
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Wednesday, April 4, 2012 5:17 PM
- Marked as answer by Jamie MileyModerator Thursday, March 7, 2013 7:25 PM
Wednesday, April 4, 2012 5:17 PMModerator -
thx for ur reply. iam already using the sdk functions to get data from the microsoft dynamics crm online. But i want to read the content of the "dashboard.aspx" from my extern application. The dashboard.aspx is not a soap service...the samples descripe only how to invoke the microsoft soap services.Thursday, April 5, 2012 11:15 AM
-
Those SOAP services or an app through an Iframe (using cross frame scripting) would be the only ways to use the api.
In the jscript cross frame scripting scenario you have to enable cross-frame scripting in the iframe properties for the specific iframe.
If you are talking about anything else besides using the SOAP services provided or using the Xrm.Page api on the client side you are looking at a solution that would be unsupported.
Jamie Miley
Check out my about.me profile!
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter!- Proposed as answer by Jamie MileyModerator Thursday, April 5, 2012 9:35 PM
- Marked as answer by Jamie MileyModerator Thursday, March 7, 2013 7:25 PM
Thursday, April 5, 2012 9:35 PMModerator -
Hello,
Did you get any solution for the same?
Thursday, September 28, 2017 10:54 AM