Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > .NET Framework 1.x
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 12th, 2007, 08:56 PM
Registered User
Join Date: Oct 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default The underlying connection was closed: An unexpecte


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.

Amardeep Dabass
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 08:30 AM.

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