Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > WebRequest

Reply
Thread Tools

WebRequest

 
 
=?Utf-8?B?TE9MTw==?=
Guest
Posts: n/a
 
      07-17-2004
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 ...


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      07-17-2004
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" <> wrote in message
news:08EF6193-F581-4BA8-AFD1-...
> 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 ...
>
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?TE9MTw==?=
Guest
Posts: n/a
 
      07-17-2004
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 ?

"Kevin Spencer" wrote:

> 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" <> wrote in message
> news:08EF6193-F581-4BA8-AFD1-...
> > 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 ...
> >
> >

>
>
>

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      07-17-2004
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.

"LOLO" <> wrote in message
news:20E7F54B-62E9-4B48-A05A-...
> 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

?
>
> "Kevin Spencer" wrote:
>
> > 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" <> wrote in message
> > news:08EF6193-F581-4BA8-AFD1-...
> > > 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 ...
> > >
> > >

> >
> >
> >



 
Reply With Quote
 
Scott Allen
Guest
Posts: n/a
 
      07-18-2004
If you need to login with forms authentication, I have an article
covering this topic here:

http://odetocode.com/Articles/162.aspx

--
Scott

On Sat, 17 Jul 2004 08:27:02 -0700, "LOLO"
<> wrote:

>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 ...
>
>


--
Scott
http://www.OdeToCode.com
 
Reply With Quote
 
=?Utf-8?B?TE9MTw==?=
Guest
Posts: n/a
 
      07-19-2004
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 ?

"Kevin Spencer" wrote:

> 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.
>
> "LOLO" <> wrote in message
> news:20E7F54B-62E9-4B48-A05A-...
> > 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

> ?
> >
> > "Kevin Spencer" wrote:
> >
> > > 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" <> wrote in message
> > > news:08EF6193-F581-4BA8-AFD1-...
> > > > 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 ...
> > > >
> > > >
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WebRequest Christian Pické ASP .Net 1 10-22-2003 03:07 AM
Re: problem with webRequest.method = post John Saunders ASP .Net 0 08-20-2003 05:48 PM
problem with webRequest.method = post Sujith Jagini ASP .Net 1 08-17-2003 07:33 AM
Sending Cookies on a WebRequest object, times out Andres ASP .Net 2 08-14-2003 03:24 PM
WebRequest - download files from directory without knowing name of file CodeMotion ASP .Net 0 07-03-2003 09:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57