If you are using code-behind to create a HttpWebRequest like var request = (HttpWebRequest)WebRequest.Create(Url); and then trying to use that request to get the WebResponse like var response = (HttpWebResponse)request.GetResponse(); This will error out as following “HttpWebRequest The underlying connection was closed: An unexpected error occurred on a send” To fix that you have to…
Month: September 2019
Want a cookie for you or foreach of you?
Ran into a weird cookie issue HttpWebRequest cookies are disabled for security by default. You need to enable it. Now if you want to add cookies from your current request, since they are seperate types, you have add it manually. Example my httpCookies – HttpContext.Current.Request.Cookies; var request = (HttpWebRequest)WebRequest.Create(url); request.CookieContainer = new CookieContainer(); //now your…