Having a problem using WebRequest inside code invoked by the Page_Load event to to download a page l

G

Guest

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/[email protected]



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

Girish Bharadwaj

You should probably use Server.Transfer() to transfer control from foo.aspx
to bar.aspx.
 
G

Guest

I can't because I want to download the rendered page (bar.aspx from inside
foo.aspx).

Girish Bharadwaj said:
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)" <[email protected]>
wrote
in message news:[email protected]...
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/[email protected]



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

Guest

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

bruce barker

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)
 
G

Guest

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

bruce barker

if you use webclient, your code is responsible for sending any cookies.

-- bruce (sqlwork.com)
 
G

Guest

Yes, I'm aware of this. I use a httpwebrequest object and copy cookies from
the HttpRequest.Cookies object.
 

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

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top