Click here to Skip to main content
15,870,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HTML
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
        // Display the contents of the page to the console.
        Stream streamResponse = myResp.GetResponseStream();
        System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
        string responseString = respStreamReader.ReadToEnd();
        respStreamReader.Close();
        myResp.Close();




error showing on
HTML
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();


pls help me..
Posted
Updated 1-Apr-20 2:09am

First you need to understand the most important part of web applications: what happens on the server, what happens on the client?
You show code regarding a WebResponse. A WebResponse is a response to a WebRequest. A WebRequest requests a URL (perhaps with some parameters) from the server.
When a server returns a 404 message, what did happen?
It did not find the URL requested by the client.
And that's it: Look at the requested URL. Does it exist on the server? Obviously not. So: what's wrong with it? What about a typo?
Remember: when you do not provide the decisive points of information, our possibilities to help are very limited.
 
Share this answer
 
Please check myReq, some thing you may miss,
This error comes when your request is not present or you are missing something in request,
if request is not present how it will get the response.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900