CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: webexception

  1. #1
    Join Date
    Nov 2004
    Posts
    2

    webexception

    In my project I have to make a request to some service and process the response. Now I have the working code in Java

    [java]
    URL url = new URL(link);
    InputStream in = url.openStream();
    Reader r = new InputStreamReader(in);
    ...
    [/java]

    And I wrote in C# like this

    [c#]
    WebRequest myWebRequest = WebRequest.Create(link);
    WebResponse myWebResponse = myWebRequest.GetResponse();
    StreamReader sr = new StreamReader(myWebResponse.GetResponseStream();
    [/c#]


    The java code works fine but c# throws {"The remote server returned an error: (500) Internal Server Error."} at 3rd line FOR THE SAME LINK!!!
    What can be a problem?

  2. #2
    Join Date
    Nov 2004
    Posts
    2

    Re: webexception

    In MSDN it says to look in Response property of WebException if the Status property is ProtocolError( it is).
    What should I be looking for in Response property that might help?

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured