Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue in hitting HTTPS server from Windows Phone
    text
    copied!<p>I am trying to hit HTTPS server from Windows Phone Device/Windows Phone Emulator. But the request is not reaching server.</p> <p>The server has SSL certificate installed and on Windows Phone I manually installed the certificate. But then also not able to proceed.</p> <p>The request is HTTPS. When we make HTTP request the phone is hitting server and response is coming but for HTTPS it is failing in between.</p> <p>Please let me know the solution for this.</p> <p>Thanks in advance.</p> <hr> <p>Below is the lass iam usig for Making a HTTP Web Request:-</p> <p>public class ConnectionHandler { /// /// Holds the status of the connection. /// public static bool done = false;</p> <pre><code> /// &lt;summary&gt; /// Holds the status of the connection /// Backkey press handling OTRS Ticket#1000543 [25 Jun 13] /// &lt;/summary&gt; public static bool initiated = false; /// &lt;summary&gt; /// Holds the response xml from the server /// &lt;/summary&gt; public static string strResponseXML { get; set; } /// &lt;summary&gt; /// Holds the parameters related to the request /// &lt;/summary&gt; public static string strRequestParams { get; set; } /// &lt;summary&gt; /// Holds the server url /// &lt;/summary&gt; public static string strUrl { get; set; } /// &lt;summary&gt; /// Holds the session cookie /// &lt;/summary&gt; public static string cookie { get; set; } /// &lt;summary&gt; /// Holds the page name parameter /// &lt;/summary&gt; public static string pageName { get; set; } /// &lt;summary&gt; /// The method &lt;code&gt;connectToServer&lt;/code&gt; sends the asynchronous request to the server. /// &lt;/summary&gt; public static void connectToServer() { // Create the web request object done = false; initiated = true; HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(strUrl); PageRequestHandler.CurrentPageURL = strUrl + "?" + strRequestParams; System.Diagnostics.Debug.WriteLine(System.DateTime.Now + "&gt;&gt;&gt;fullpageRequest&gt;&gt;&gt;" + PageRequestHandler.CurrentPageURL); System.Diagnostics.Debug.WriteLine(System.DateTime.Now + "&gt;&gt;&gt;PostData&gt;&gt;&gt;" + getParam()); System.Diagnostics.Debug.WriteLine(System.DateTime.Now + "&gt;&gt;&gt;PostData&gt;&gt;&gt;" + strRequestParams); webRequest.Method = "POST"; webRequest.ContentType = "application/x-www-form-urlencoded"; //webRequest.Headers["Cookie"] = cookie; // Start the request webRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), webRequest); while (!done) { Thread.Sleep(100); } } /// &lt;summary&gt; /// The method &lt;code&gt;GetRequestStreamCallback&lt;/code&gt; sends the parameters to the request and start getting the response asynchronously. /// &lt;/summary&gt; /// &lt;param name="asynchronousResult"&gt;&lt;/param&gt; static void GetRequestStreamCallback(IAsyncResult asynchronousResult) { HttpWebRequest webRequest = (HttpWebRequest)asynchronousResult.AsyncState; //End the stream request operation Stream postStream = webRequest.EndGetRequestStream(asynchronousResult); // Add the request parameters to the web request //strRequestParams = "Channel=WP7&amp;screenWidth=480&amp;screenHeight=700&amp;page=CheckBoxHome"; byte[] byteArray = Encoding.UTF8.GetBytes(getParam()); postStream.Write(byteArray, 0, byteArray.Length); postStream.Close(); // Start the web request webRequest.BeginGetResponse(new AsyncCallback(GetResponseCallback), webRequest); } /// &lt;summary&gt; /// The method &lt;code&gt;GetResponseCallback&lt;/code&gt; receives the response asynchronously and store the response xml in strResponseXML. /// &lt;/summary&gt; /// &lt;param name="asynchronousResult"&gt;&lt;/param&gt; static void GetResponseCallback(IAsyncResult asynchronousResult) { StreamReader streamReader = null; try { strResponseXML = ""; HttpWebRequest webRequest = (HttpWebRequest)asynchronousResult.AsyncState; HttpWebResponse response; // End the get response operation response = (HttpWebResponse)webRequest.EndGetResponse(asynchronousResult); //cookie=response.Cookies["Set-Cookie"].ToString(); Stream streamResponse = response.GetResponseStream(); streamReader = new StreamReader(streamResponse); strResponseXML = streamReader.ReadToEnd(); streamResponse.Close(); streamReader.Close(); response.Close(); System.Diagnostics.Debug.WriteLine(System.DateTime.Now + "&gt;&gt;&gt;Response xml from server&gt;&gt;&gt;\n" + strResponseXML); } catch (WebException e) { // Error treatment // ... string ex = e.Message; } done = true; initiated = false; //Deployment.Current.Dispatcher.BeginInvoke(new Action(() =&gt; //{ // strResponseXML = streamReader.ReadToEnd(); //})); //streamReader.Close(); } static string GetEncodedValue(string value) { if (Convert.ToBoolean(ConfigManager.URL_ENCODE)) { return HttpUtility.UrlEncode(value); } else return value; } static string getParam() { string param = ""; if (ConnectionHandler.strRequestParams.Contains("&amp;")) { string[] paramArray = strRequestParams.Split('&amp;'); foreach (string keyValue in paramArray) { if (keyValue.Contains("=")) { string[] keys = keyValue.Split('='); param = param+keys[0]+"="+GetEncodedValue(keys[1])+"&amp;"; } } } else param = ConnectionHandler.strRequestParams; return param; } } </code></pre> <p>From HTTP Web Server I downloded the certificate and insalled on phone s well manually.</p> <p>Pease help i resolving the issue.</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload