Saturday, March 24, 2012
System.Net.Webexecption on WebRequest.GetResponse
after a while, ive had to maintain a ASP.NET/C# project, where
during processing of an request, the same (local!) webserver is
requested again for the response of a corresponding aspx-page.
Something like this:
...
string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
WebRequest req = WebRequest.Create( uri );
req.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();
Stream st = req.GetResponseStream;
...
This worked fine on my machine a few month ago, as well as on my
collegues machine and alos at the customer.
On all 3 machines, the local IIS instance is responsible to process
the aspx-Request (two XP-SP2, one W2k-Server).
Acutally, when i perform this again, ill get a
System.Net.Webexecption
on the execution of "req.GetResponse()" with following error-stack
System.Net.HttpWebRequest.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
System.Net.HttpWebRequest.CheckFinalStatus()
myModule.myMethod()
etc. ...
This error appears also, when i replace the uri above f.e. with
'http://www.google.com'.
Even when i run a downloaded, ready-to-use C#-sample (EXE, not
ASP.NET!),
ill get this error.
On my collegues machine, the same things still works fine, even on the
customers
server, but im not able to test/debug this one on my machine anymore.
I dont know, what could be the reason for it.
My XPs configuration seems very identical to my collegues one.
Also my XP Servicepacks, Patches and .NET-Version look identical to
my
collegue ones.
But there must be a difference!
Does anyone has any idea, that maybe can keep me away from a complete
reinstallation of my machine?
Thanks in advance,
ThomasThis exception is also thrown if the statuscode is 404 for example. Have a
look at this:
<http://msdn.microsoft.com/library/d...o
pic.asp>
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/
"Thomas Geisel" <tgeisel@.symax.de> wrote in message
news:b455c2e.0501180203.cba6e16@.posting.google.com...
> Hi Everybody,
> after a while, ive had to maintain a ASP.NET/C# project, where
> during processing of an request, the same (local!) webserver is
> requested again for the response of a corresponding aspx-page.
> Something like this:
> ...
> string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
> WebRequest req = WebRequest.Create( uri );
> req.Credentials = CredentialCache.DefaultCredentials;
> WebResponse resp = req.GetResponse();
> Stream st = req.GetResponseStream;
> ...
> This worked fine on my machine a few month ago, as well as on my
> collegues machine and alos at the customer.
> On all 3 machines, the local IIS instance is responsible to process
> the aspx-Request (two XP-SP2, one W2k-Server).
> Acutally, when i perform this again, ill get a
> System.Net.Webexecption
> on the execution of "req.GetResponse()" with following error-stack
> System.Net.HttpWebRequest.CheckFinalStatus()
> System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
> System.Net.HttpWebRequest.CheckFinalStatus()
> myModule.myMethod()
> etc. ...
> This error appears also, when i replace the uri above f.e. with
> 'http://www.google.com'.
> Even when i run a downloaded, ready-to-use C#-sample (EXE, not
> ASP.NET!),
> ill get this error.
> On my collegues machine, the same things still works fine, even on the
> customers
> server, but im not able to test/debug this one on my machine anymore.
> I dont know, what could be the reason for it.
> My XPs configuration seems very identical to my collegues one.
> Also my XP Servicepacks, Patches and .NET-Version look identical to
> my
> collegue ones.
> But there must be a difference!
> Does anyone has any idea, that maybe can keep me away from a complete
> reinstallation of my machine?
> Thanks in advance,
> Thomas
System.Net.Webexecption on WebRequest.GetResponse
after a while, ive had to maintain a ASP.NET/C# project, where
during processing of an request, the same (local!) webserver is
requested again for the response of a corresponding aspx-page.
Something like this:
...
string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
WebRequest req = WebRequest.Create( uri );
req.Credentials = CredentialCache.DefaultCredentials;
WebResponse resp = req.GetResponse();
Stream st = req.GetResponseStream;
...
This worked fine on my machine a few month ago, as well as on my
collegues machine and alos at the customer.
On all 3 machines, the local IIS instance is responsible to process
the aspx-Request (two XP-SP2, one W2k-Server).
Acutally, when i perform this again, ill get a
System.Net.Webexecption
on the execution of "req.GetResponse()" with following error-stack
System.Net.HttpWebRequest.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult)
System.Net.HttpWebRequest.CheckFinalStatus()
myModule.myMethod()
etc. ...
This error appears also, when i replace the uri above f.e. with
'http://www.google.com'.
Even when i run a downloaded, ready-to-use C#-sample (EXE, not
ASP.NET!),
ill get this error.
On my collegues machine, the same things still works fine, even on the
customers
server, but im not able to test/debug this one on my machine anymore.
I dont know, what could be the reason for it.
My XPs configuration seems very identical to my collegues one.
Also my XP Servicepacks, Patches and .NET-Version look identical to
my
collegue ones.
But there must be a difference!
Does anyone has any idea, that maybe can keep me away from a complete
reinstallation of my machine?
Thanks in advance,
ThomasThis exception is also thrown if the statuscode is 404 for example. Have a
look at this:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetwebrequestclassendgetresponsetopic.a sp
--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/
"Thomas Geisel" <tgeisel@.symax.de> wrote in message
news:b455c2e.0501180203.cba6e16@.posting.google.com ...
> Hi Everybody,
> after a while, ive had to maintain a ASP.NET/C# project, where
> during processing of an request, the same (local!) webserver is
> requested again for the response of a corresponding aspx-page.
> Something like this:
> ...
> string uri = 'http://localhost/appname/secondpage.aspx?ItemId=4711';
> WebRequest req = WebRequest.Create( uri );
> req.Credentials = CredentialCache.DefaultCredentials;
> WebResponse resp = req.GetResponse();
> Stream st = req.GetResponseStream;
> ...
> This worked fine on my machine a few month ago, as well as on my
> collegues machine and alos at the customer.
> On all 3 machines, the local IIS instance is responsible to process
> the aspx-Request (two XP-SP2, one W2k-Server).
> Acutally, when i perform this again, ill get a
> System.Net.Webexecption
> on the execution of "req.GetResponse()" with following error-stack
> System.Net.HttpWebRequest.CheckFinalStatus()
> System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult)
> System.Net.HttpWebRequest.CheckFinalStatus()
> myModule.myMethod()
> etc. ...
> This error appears also, when i replace the uri above f.e. with
> 'http://www.google.com'.
> Even when i run a downloaded, ready-to-use C#-sample (EXE, not
> ASP.NET!),
> ill get this error.
> On my collegues machine, the same things still works fine, even on the
> customers
> server, but im not able to test/debug this one on my machine anymore.
> I dont know, what could be the reason for it.
> My XPs configuration seems very identical to my collegues one.
> Also my XP Servicepacks, Patches and .NET-Version look identical to
> my
> collegue ones.
> But there must be a difference!
> Does anyone has any idea, that maybe can keep me away from a complete
> reinstallation of my machine?
> Thanks in advance,
> Thomas
Tuesday, March 13, 2012
System.Threading.ThreadAbortException and Response.Redirect
I have an ASP.net 2.0 app on a W2K3 box. I am using Response.Redirect inside page_load. After reading a bunch of posts, I've tried setting the second arg to false, but still get the error. I've also tried moving the redirect outside the try block. No love. I catch and ignore the error, but the redirect doesn't redirect to the new url.
All worked fine until this started happening out of the blue.
Thanks.
I assume you meant to post your code... but you forgot. Can you post your problem code please?
oops. Sorry.
If Request.QueryString("testnum") Is Nothing Then
Response.Redirect("http://localhost:10607/WWW/testing.aspx?testnum=1.11-.01-C1-T1&ucid=0")
End if
Have you tried using a relative URL, instead of an absolute URL?
The thing is, the built in web server in Visual Studio (Cassini) uses dynamic port assignment. Therefore, there is no guarantee (in fact no likelihood at all) that the port used will be the same every time.
Try a URL of"~/testing.aspx?testnum=1.11-.01-C1-T1&ucid=0"