By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,354 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,354 IT Pros & Developers. It's quick & easy.

Having a problem using WebRequest inside code invoked by the Page_Load event to to download a page located on same server (as the currently executing page).

P: n/a
I have a website with 2 aspx pages
Foo.aspx, and bar.aspx
The content of both files
is

//in 1 file
Hello <%=Session["Name"].ToString()%>
================
Here's the problem, inside the Page_Load for
Foo.aspx, using the HttpWebRequest, I do a request
to bar.aspx, passing in the session cookie. A timeout occurs.
When I use a debugger and set a break point at bar.aspx's Page_Load,
the breakpoint is reached only after the HttpWebRequest throws a timeout
exception inside Foo.aspx's Page_Load. Setting the timeout to higher numbers
has no effect. Creating a webrequest to a page not on the same server as
mine does not generate an error. e.x.: downloading cnn.com's homepage from
within Foo.aspx will work. Does anyone know why this would happen. Please
post back if any clarification is needed.
I feel it may have something to do with the thread process used by iis
and/or aspnet.

It's sort of like the problem that's reported here ->
http://groups.google.com/groups?hl=e...utheast.rr.com

I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
should be running in debug mode.
Nov 18 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
You should probably use Server.Transfer() to transfer control from foo.aspx
to bar.aspx.
--
Girish Bharadwaj
http://msmvps.com/gbvb
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com> wrote
in message news:eG**************@TK2MSFTNGP15.phx.gbl...
I have a website with 2 aspx pages
Foo.aspx, and bar.aspx
The content of both files
is

//in 1 file
Hello <%=Session["Name"].ToString()%>
================
Here's the problem, inside the Page_Load for
Foo.aspx, using the HttpWebRequest, I do a request
to bar.aspx, passing in the session cookie. A timeout occurs.
When I use a debugger and set a break point at bar.aspx's Page_Load,
the breakpoint is reached only after the HttpWebRequest throws a timeout
exception inside Foo.aspx's Page_Load. Setting the timeout to higher numbers has no effect. Creating a webrequest to a page not on the same server as
mine does not generate an error. e.x.: downloading cnn.com's homepage from
within Foo.aspx will work. Does anyone know why this would happen. Please
post back if any clarification is needed.
I feel it may have something to do with the thread process used by iis
and/or aspnet.

It's sort of like the problem that's reported here ->
http://groups.google.com/groups?hl=e...utheast.rr.com
I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
should be running in debug mode.

Nov 18 '05 #2

P: n/a
I can't because I want to download the rendered page (bar.aspx from inside
foo.aspx).

"Girish Bharadwaj" <gi*****@mvps.org> wrote in message
news:ub**************@TK2MSFTNGP11.phx.gbl...
You should probably use Server.Transfer() to transfer control from
foo.aspx
to bar.aspx.
--
Girish Bharadwaj
http://msmvps.com/gbvb
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com>
wrote
in message news:eG**************@TK2MSFTNGP15.phx.gbl...
I have a website with 2 aspx pages
Foo.aspx, and bar.aspx
The content of both files
is

//in 1 file
Hello <%=Session["Name"].ToString()%>
================
Here's the problem, inside the Page_Load for
Foo.aspx, using the HttpWebRequest, I do a request
to bar.aspx, passing in the session cookie. A timeout occurs.
When I use a debugger and set a break point at bar.aspx's Page_Load,
the breakpoint is reached only after the HttpWebRequest throws a timeout
exception inside Foo.aspx's Page_Load. Setting the timeout to higher

numbers
has no effect. Creating a webrequest to a page not on the same server as
mine does not generate an error. e.x.: downloading cnn.com's homepage
from
within Foo.aspx will work. Does anyone know why this would happen. Please
post back if any clarification is needed.
I feel it may have something to do with the thread process used by iis
and/or aspnet.

It's sort of like the problem that's reported here ->

http://groups.google.com/groups?hl=e...utheast.rr.com

I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
should be running in debug mode.


Nov 18 '05 #3

P: n/a
i have used WebClient to fetch a rendered page.
I normally use
http://www.domainname.com/pagename.aspx to open the webclient and then read
the data.
leave it to do the dns query and resolution.

though with webclient i never had to bother with session cookies etc

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com> wrote
in message news:eG**************@TK2MSFTNGP15.phx.gbl...
I have a website with 2 aspx pages
Foo.aspx, and bar.aspx
The content of both files
is

//in 1 file
Hello <%=Session["Name"].ToString()%>
================
Here's the problem, inside the Page_Load for
Foo.aspx, using the HttpWebRequest, I do a request
to bar.aspx, passing in the session cookie. A timeout occurs.
When I use a debugger and set a break point at bar.aspx's Page_Load,
the breakpoint is reached only after the HttpWebRequest throws a timeout
exception inside Foo.aspx's Page_Load. Setting the timeout to higher
numbers has no effect. Creating a webrequest to a page not on the same
server as mine does not generate an error. e.x.: downloading cnn.com's
homepage from within Foo.aspx will work. Does anyone know why this would
happen. Please post back if any clarification is needed.
I feel it may have something to do with the thread process used by iis
and/or aspnet.

It's sort of like the problem that's reported here ->
http://groups.google.com/groups?hl=e...utheast.rr.com

I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
should be running in debug mode.

Nov 18 '05 #4

P: n/a
I would also like to add that, when in debugging
If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I open
IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
request, and I think it's because Thread.SLeep() was being executed in
Foo.aspx) which was called by a different browser window.

interesting.. I'm going to check my iis settings. it's as if my iis server
is single threaded.
Nov 18 '05 #5

P: n/a
IE uses a common process for http requests (by design to implement the
limited connection rule), so that even if you use more than 1 browser
instance, if your breakpoint blocks a request, all browsers are blocked.

-- bruce (sqlwork.com)
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com> wrote
in message news:u9**************@TK2MSFTNGP14.phx.gbl...
I would also like to add that, when in debugging
If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I open IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
request, and I think it's because Thread.SLeep() was being executed in
Foo.aspx) which was called by a different browser window.

interesting.. I'm going to check my iis settings. it's as if my iis server
is single threaded.

Nov 18 '05 #6

P: n/a
Running it without being attached from a debugger produces the same result.
If I switch the application to cookiless where the session id is passed
around through the url, it seems to work but unfortunately, I have to store
the session id in cookies.
"bruce barker" <no***********@safeco.com> wrote in message
news:Oo**************@TK2MSFTNGP15.phx.gbl...
IE uses a common process for http requests (by design to implement the
limited connection rule), so that even if you use more than 1 browser
instance, if your breakpoint blocks a request, all browsers are blocked.

-- bruce (sqlwork.com)
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com>
wrote
in message news:u9**************@TK2MSFTNGP14.phx.gbl...
I would also like to add that, when in debugging
If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I

open
IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
request, and I think it's because Thread.SLeep() was being executed in
Foo.aspx) which was called by a different browser window.

interesting.. I'm going to check my iis settings. it's as if my iis
server
is single threaded.


Nov 18 '05 #7

P: n/a
Case closed -- HttpServerUtility.Execute Method (String, TextWriter)

http://msdn.microsoft.com/library/de...cutetopic2.asp

I thank everyone for their input and timely response.

"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com> wrote
in message news:eG**************@TK2MSFTNGP15.phx.gbl...
I have a website with 2 aspx pages
Foo.aspx, and bar.aspx
The content of both files
is

//in 1 file
Hello <%=Session["Name"].ToString()%>
================
Here's the problem, inside the Page_Load for
Foo.aspx, using the HttpWebRequest, I do a request
to bar.aspx, passing in the session cookie. A timeout occurs.
When I use a debugger and set a break point at bar.aspx's Page_Load,
the breakpoint is reached only after the HttpWebRequest throws a timeout
exception inside Foo.aspx's Page_Load. Setting the timeout to higher
numbers has no effect. Creating a webrequest to a page not on the same
server as mine does not generate an error. e.x.: downloading cnn.com's
homepage from within Foo.aspx will work. Does anyone know why this would
happen. Please post back if any clarification is needed.
I feel it may have something to do with the thread process used by iis
and/or aspnet.

It's sort of like the problem that's reported here ->
http://groups.google.com/groups?hl=e...utheast.rr.com

I'm using winxp pro w/ .net 1.1 and vs.net 2003. Everything .net related
should be running in debug mode.

Nov 18 '05 #8

P: n/a
if you use webclient, your code is responsible for sending any cookies.

-- bruce (sqlwork.com)
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com> wrote
in message news:OC**************@tk2msftngp13.phx.gbl...
Running it without being attached from a debugger produces the same result. If I switch the application to cookiless where the session id is passed
around through the url, it seems to work but unfortunately, I have to store the session id in cookies.
"bruce barker" <no***********@safeco.com> wrote in message
news:Oo**************@TK2MSFTNGP15.phx.gbl...
IE uses a common process for http requests (by design to implement the
limited connection rule), so that even if you use more than 1 browser
instance, if your breakpoint blocks a request, all browsers are blocked.

-- bruce (sqlwork.com)
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com>
wrote
in message news:u9**************@TK2MSFTNGP14.phx.gbl...
I would also like to add that, when in debugging
If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping, I

open
IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed by
request, and I think it's because Thread.SLeep() was being executed in
Foo.aspx) which was called by a different browser window.

interesting.. I'm going to check my iis settings. it's as if my iis
server
is single threaded.



Nov 18 '05 #9

P: n/a
Yes, I'm aware of this. I use a httpwebrequest object and copy cookies from
the HttpRequest.Cookies object.
"bruce barker" <no***********@safeco.com> wrote in message
news:OQ*************@tk2msftngp13.phx.gbl...
if you use webclient, your code is responsible for sending any cookies.

-- bruce (sqlwork.com)
"Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com>
wrote
in message news:OC**************@tk2msftngp13.phx.gbl...
Running it without being attached from a debugger produces the same

result.
If I switch the application to cookiless where the session id is passed
around through the url, it seems to work but unfortunately, I have to

store
the session id in cookies.
"bruce barker" <no***********@safeco.com> wrote in message
news:Oo**************@TK2MSFTNGP15.phx.gbl...
> IE uses a common process for http requests (by design to implement the
> limited connection rule), so that even if you use more than 1 browser
> instance, if your breakpoint blocks a request, all browsers are
> blocked.
>
> -- bruce (sqlwork.com)
>
>
> "Hasani (remove nospam from address)" <hb********@n0sp4m.popstick.com>
> wrote
> in message news:u9**************@TK2MSFTNGP14.phx.gbl...
>> I would also like to add that, when in debugging
>> If inside Foo.aspx, I say Thread.Sleep(); while Foo.aspx is sleeping,
>> I
> open
>> IE using and go to Bar.aspx and it hangs (as if IIS hasn't processed
>> by
>> request, and I think it's because Thread.SLeep() was being executed in
>> Foo.aspx) which was called by a different browser window.
>>
>> interesting.. I'm going to check my iis settings. it's as if my iis
>> server
>> is single threaded.
>>
>>
>
>



Nov 18 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.