×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    6

    Question HTTPS server hit problem from Windows Phone

    Hi,

    I am trying to hit HTTPS server from Windows Phone Device/Windows Phone Emulator. But the request is not reaching server.

    The server has SSL certificate installed and on Windows Phone I manually installed the certificate. But then also not able to proceed.

    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.

    Please let me know the solution for this.


    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Nov 2013
    Posts
    29

    Re: HTTPS server hit problem from Windows Phone

    do you get an exception in the app?

  3. #3
    Registered User
    Join Date
    Nov 2013
    Posts
    6

    Re: HTTPS server hit problem from Windows Phone

    Hi,

    Yes on Phone/Emulator it says "Server not found or is not running". And on Server no logs generated for the hit. My other team mates are making app for Android and iPhone and they are able to hit the server and get the response.

    Please help me get out of this.


    Thanks

  4. #4
    Registered User
    Join Date
    Nov 2013
    Posts
    29

    Re: HTTPS server hit problem from Windows Phone

    have a look at this article, maybe it can help you http://blog.toetapz.com/2010/11/15/w...uthentication/
    (it's for WP7 but it'll apply to WP8 as well)

  5. #5
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: HTTPS server hit problem from Windows Phone

    I have same type of problem with a server that has self signed certificate. I try to post xml to it and when completed, I get aswer: "The remote server returned an error: NotFound."
    Code:
                WebClient req = new WebClient();
                req.Headers["Content-type"] = "text/xml";
                req.UploadStringAsync(new Uri(url), "POST", postdata);
                req.UploadStringCompleted += req_UploadStringCompleted;

  6. #6
    Registered User
    Join Date
    Nov 2013
    Posts
    6

    Re: HTTPS server hit problem from Windows Phone

    Hi,

    I am using HTTP Web Request and facing issue in both Windows Phone Device and Windows Phone Emulator.

    On device the issue is checked on Windows Phone 7.5, 7.8, 8.0. On Emulator the issue is checked on Windows Phone Emulator 7.1.

    Also, the certificate we installed manually on Phone as well as on System (for Emulator).


    We are using below LOC for hitting server :-

    public static void connectToServer()
    {
    // Create the web request object
    done = false;
    initiated = true;
    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(strUrl);
    webRequest.Method = "POST";

    webRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
    webRequest.AllowAutoRedirect = true;
    webRequest.AllowReadStreamBuffering = true;


    webRequest.UseDefaultCredentials = false;

    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);
    }
    }

    /// <summary>
    /// The method <code>GetRequestStreamCallback</code> sends the parameters to the request and start getting the response asynchronously.
    /// </summary>
    /// <param name="asynchronousResult"></param>
    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&screenWidth=480&screenHeight=700&page=CheckBoxHome";

    byte[] byteArray = Encoding.UTF8.GetBytes(strRequestParams);

    postStream.Write(byteArray, 0, byteArray.Length);

    postStream.Close();

    // Start the web request

    webRequest.BeginGetResponse(new AsyncCallback(GetResponseCallback), webRequest);

    }

    /// <summary>
    /// The method <code>GetResponseCallback</code> receives the response asynchronously and store the response xml in strResponseXML.
    /// </summary>
    /// <param name="asynchronousResult"></param>
    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 + ">>>Response xml from server>>>\n" + strResponseXML);
    }

    catch (WebException e)
    {
    // Error treatment
    // ...
    string ex = e.Message;

    }
    done = true;
    initiated = false;
    }


    The error coming while hitting the server is “webexception: remoteserver not found”.


    Please help in resolving the issue.


    Thanks

  7. #7
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: HTTPS server hit problem from Windows Phone

    I'm stuck with this. Is there anything to do ? The server I'm posting is a public server and it has a not-trusted certificate. How can I accept it ?

    Quote Originally Posted by pkarpion View Post
    I have same type of problem with a server that has self signed certificate. I try to post xml to it and when completed, I get aswer: "The remote server returned an error: NotFound."
    Code:
                WebClient req = new WebClient();
                req.Headers["Content-type"] = "text/xml";
                req.UploadStringAsync(new Uri(url), "POST", postdata);
                req.UploadStringCompleted += req_UploadStringCompleted;

Similar Threads

  1. [moved] https problem when connecting to https://m.vk.com
    By Marvel84 in forum Mobile Java Networking & Messaging & Security
    Replies: 7
    Last Post: 2014-05-13, 09:27
  2. Replies: 4
    Last Post: 2013-11-12, 09:58
  3. Windows 8 Phone Client Certificate HTTPS authentication
    By deadlock83 in forum Windows Phone General
    Replies: 0
    Last Post: 2013-03-15, 16:06
  4. Https request problem whith PAMP. Is https/SSL supported?
    By yakimov in forum Mobile Web Server
    Replies: 0
    Last Post: 2010-01-24, 11:31
  5. Multimedia Converter on Windows Server 2003 - install problem
    By elsenordhagen in forum Streaming and Video
    Replies: 1
    Last Post: 2005-12-22, 10:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×