M
michi
Hello there....
I try to call a aspx file within an running asxp file. The key thing
is that I need to pass the active ASP.NET_SessionID to this new aspx
file via HttpWebRequest.GetResponse Method. Then I want to read the
whole thing with a stream object.
The weird thing happen at Line 9, after the timeout (1sec) is over.
ASP.NET throws an timeout exeption. Even when I set the timeout to 5
min, ASP is waiting always until a timeout expires
If I implement a Try/Catch at line 9, after the timeout my debugger
jumps to the new aspx file where I set a breakpoint. Also it uses the
same session ID
But the "objResponse" in line 9 is set to NOTHING and all the
following code fail because of that.
What do I have to do that the GetResponse Method works properly.
Thanks
Michael
********************My Code********************
1 Dim objResponse As HttpWebResponse
2 Dim objRequest As HttpWebRequest
3 Dim sr As StreamReader
4 Dim result As String
'**1 Create the Request object******************
5 objRequest = System.Net.HttpWebRequest.Create("http://localhost/aidsgame/test_result.aspx")
'***2 Add the container with the active sessionID***
6 objRequest.CookieContainer = New System.Net.CookieContainer(50)
7 objRequest.CookieContainer.Add(New
System.Uri("http://localhost/aidsgame"), New
System.Net.Cookie("ASP.NET_SessionId",
Request.Cookies("ASP.NET_SessionId").Value))
8 objRequest.Timeout = 1000
9 objResponse = objRequest.GetResponse() <---throws timeout
exeption
10 sr = New StreamReader(objResponse.GetResponseStream())
11 result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
********************************************
I try to call a aspx file within an running asxp file. The key thing
is that I need to pass the active ASP.NET_SessionID to this new aspx
file via HttpWebRequest.GetResponse Method. Then I want to read the
whole thing with a stream object.
The weird thing happen at Line 9, after the timeout (1sec) is over.
ASP.NET throws an timeout exeption. Even when I set the timeout to 5
min, ASP is waiting always until a timeout expires
If I implement a Try/Catch at line 9, after the timeout my debugger
jumps to the new aspx file where I set a breakpoint. Also it uses the
same session ID
But the "objResponse" in line 9 is set to NOTHING and all the
following code fail because of that.
What do I have to do that the GetResponse Method works properly.
Thanks
Michael
********************My Code********************
1 Dim objResponse As HttpWebResponse
2 Dim objRequest As HttpWebRequest
3 Dim sr As StreamReader
4 Dim result As String
'**1 Create the Request object******************
5 objRequest = System.Net.HttpWebRequest.Create("http://localhost/aidsgame/test_result.aspx")
'***2 Add the container with the active sessionID***
6 objRequest.CookieContainer = New System.Net.CookieContainer(50)
7 objRequest.CookieContainer.Add(New
System.Uri("http://localhost/aidsgame"), New
System.Net.Cookie("ASP.NET_SessionId",
Request.Cookies("ASP.NET_SessionId").Value))
8 objRequest.Timeout = 1000
9 objResponse = objRequest.GetResponse() <---throws timeout
exeption
10 sr = New StreamReader(objResponse.GetResponseStream())
11 result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
********************************************