473,383 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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

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
9 2742
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: XSD-optimist | last post by:
I am trying to generate the classes for an XSD schema using the Microsoft XSD Object Code Generator (XSDObjGen). I am having a schema that contains the definition of the following: 1. a complex...
2
by: Chris Newby | last post by:
Is there a static context property that will give access to the currently executing System.Web.UI.Page instance? ... doesn't seem like there would be, but thought i'd ask. TIA//
2
by: Stefan | last post by:
Hello, for the implementation of a http module I have to get to the currently executing page handler (to query some specific page properties via reflection). I was looking at ...
2
by: Utilisateur1 | last post by:
Hello, I'm trying to use an OCX written in VC++ 6.0 in an ASPX page. I've set a reference to it in the project. I can see it in the object explorer with all of its methods and properties. So when...
0
by: JuHui | last post by:
Hi : I want to get many html page on same server. I have tried httplib and urllib. I think httplib is better one because it's httplib.HTTPConnection. It will establish one network connection then...
0
by: dkoppe | last post by:
I'm using C#.NET WebRequest and HTTPResponse to post data to a server and I'm reading the response into a stream. Does anyone know how to split the returned values like a request.form. Here is the...
1
by: Kelie | last post by:
Hello, I tried using xlrd to read an Excel file and kept getting this error: AttributeError: 'Book' object has no attribute 'mem' AttributeError: 'Book' object has no attribute 'mem' ...
3
by: Bobby | last post by:
Hi Can anybody tell me why the VBA code below works fine in Access 2003 but doesn't work in Access 2007? I do not get any error message, even if I put a deliberate error into the code. Also, if I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.