HttpWebRequest Credentials stored/cached automatically?

185 views Asked by At

I have an HttpWebRequest with Credentials, as seen below. This works perfectly well. However, something strange happens when I change my password on the server side: subsequent requests to the same URL are successful, even though the password is no longer valid.

This behavior continues even if I close the app completely and reopen it. Do the Credentials persist somehow? Any insight would be greatly appreciated.

try
{
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(item.Url) as HttpWebRequest;

    nc = new NetworkCredential();

    nc.UserName = Username;
    nc.Password = Password;

    request.Credentials = nc;

    request.BeginGetResponse(new AsyncCallback(SubReadWebRequestCallback), request);
}
0

There are 0 answers