“System.Web.HttpException: Response is not available in this context” only in IIS

空扰寡人 提交于 2019-12-07 18:41:29

I would not do request/response oriented things in Application_Start. Try doing it in BeginRequest.

Paddy

The request context is not available in application start when running in integrated mode in IIS7.

Please see my question and the accepted answer here for details:

Global ASAX - get the server name


Would also note that there seems to be a logical bug in your code - this will set the cookie only for the person that hits the site when the application starts - this will not run for every request, or every session.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!