Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > .NET Framework 1.x
|
.NET Framework 1.x For discussing versions 1.0 and 1.1 of the Microsoft .NET Framework.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 1.x section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 12th, 2007, 08:56 PM
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default The underlying connection was closed: An unexpecte

Hi,

I am trying to post login credentials to a web page using __viewstate and my credentials for login. Here is what I do -
1. Request for the sign on page.
2. Receive the response
3. Extract the viewstate out.
4. Attach my credentials.
5. Post a new request for login.
6. Receive the response.

The program fails at step 6 and I receive the error "The underlying connection was closed: An unexpected error occurred on a receive.". I caught the WebException and it gives me no further details just that it shows the status of the exception as "ReceiveFailure". I tried somethings like

a) Set KeepAlive = false.
b) Set AutoRedirects = true.
but it didn't work.

For testing purpose - I copied the viewstate that I extracted, put the credentials as hidden field and submitted the form as plain html and I was able to login. That just means that there is something that I am not doing right, or .Net is not allowing me to do correctly. (I am using .Net 1.1)

The stack trace is as follows -

at System.Net.HttpWebRequest.CheckFinalStatus() at System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at System.Net.HttpWebRequest.GetResponse() at WebLoginCheck.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\weblogincheck\webform1.aspx.cs: line 78

Can somebody give me an insight on origin of the problem and what could be the possible causes. I will appreciate your inputs.

Thanks
Amardeep Dabass





Similar Threads
Thread Thread Starter Forum Replies Last Post
The underlying connection was closed: jhouse .NET Web Services 33 September 21st, 2011 04:26 PM
The underlying connection was closed: An unexpecte ksumijain .NET Web Services 0 April 4th, 2008 12:42 PM
The underlying connection was closed: unable to co badyalsk .NET Web Services 0 January 23rd, 2007 04:42 AM
Underlying connection was closed r_ganesh76 .NET Web Services 0 May 4th, 2006 04:49 AM
The underlying connection was closed: Unable to co anurag_singh02 .NET Web Services 1 August 17th, 2005 11:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.