“System.Web.HttpException: Response is not available in this context” only in IIS
i have used the Http.Current.Response in my global.asax.cs Application Start. It is working fine without any issue when i execute in my PC. How ever when i try to put it in IIS with Windows Server 2008 R2, i find that it is giving the following error. the code for it is public static void SetCookie(string key, string value, int dayExpires) { HttpCookie encodedCookie = HttpSecureCookie.Encode(new HttpCookie(key, value)); encodedCookie.Expires = DateTime.Now.AddDays(dayExpires); HttpContext.Current.Response.Cookies.Remove(key); HttpContext.Current.Response.Cookies.Add(encodedCookie); } I wanted