System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a sen

Discussion in 'ASP .Net Web Services' started by Steven Harris, Aug 14, 2003.

  1. Hi.

    I've read several posts on this and the general consensus seems to be
    if you override the GetWebRequest and set .KeepAlive = False it cures
    the problem.

    This worked well BUT after-setting this I was unable to get proxy
    authentication working, always getting a 407 Proxy Authentication

    I have tried several ways of getting through the proxy i.e.

    1. g_PROXY.Credentials = New Net.NetworkCredential(txtUsername.Text,
    txtPassword.Text, txtDomain.Text)

    2. 'Dim netCred As New System.Net.NetworkCredential
    'netCred.UserName = txtUsername.Text
    'netCred.Password = txtPassword.Text
    'netCred.Domain = txtDomain.Text

    'Dim objCredentials As New System.Net.CredentialCache
    'objCredentials.Add(New Uri(g_WEBREF.Url), "NTLM", netCred)
    'objCredentials.Add(New Uri(g_WEBREF.Url), "BASIC", netCred)
    'g_PROXY.Credentials = objCredentials

    So to sum it up, If I dont override the GetWebRequest and leave
    ".KeepAlive = True" then
    it all works fine, with and without supplying crudentials (username,
    password, domain).

    Can anyone tell me why setting .KeepAlive = False cause proxy
    authentication problems???

    Many Thanks
    Steven Harris, Aug 14, 2003
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page