WebRequest

G

Guest

I want to save in a file the HTML code generated by a WebRequest to an aspx page.

When a connect to a external site, i can obtain the html code generated by server. But when i connect to a page of my application, the server responds "(401) Non autorisé. "

the is:

WebRequest request=WebRequest.Create("http://localhost/software/tools/pages/index.htm");
WebResponse response=request.GetResponse();
Stream stream=response.GetResponseStream();

the error is on the "WebResponse response=request.GetResponse();" only if the page is an aspx page in my code but never on an external site ...
 
K

Kevin Spencer

Try using the IP address of your local machine instead of "localhost."

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

LOLO said:
I want to save in a file the HTML code generated by a WebRequest to an aspx page.

When a connect to a external site, i can obtain the html code generated by
server. But when i connect to a page of my application, the server responds
"(401) Non autorisé. "
the is:

WebRequest request=WebRequest.Create("http://localhost/software/tools/pages/index.htm")
;
WebResponse response=request.GetResponse();
Stream stream=response.GetResponseStream();

the error is on the "WebResponse response=request.GetResponse();" only if
the page is an aspx page in my code but never on an external site ...
 
G

Guest

thank you for this idea but it's the same problem.
do you know another way to get the server generated html code ?

from inside the form (using response variable) or from an external request ?
 
K

Kevin Spencer

It's a 401 error, which is "unauthorized." It sounds like your app may
require a login (disallow anonymous requests)?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
G

Guest

It feel like when you try to refresh the page using 'F5'--> you have to repost the data.
I think when i try to open the response request , i should have to close something into the current page but i d'ont know what. some on have an idea ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top