什么时候可以在ASP.NET MVC中进行对象为null?
我在日志中找到了与控制器方法有关的null参考异常。是否有任何场景可以为null吗?
这是我遇到的错误。 System.Web.httpexception(0x80004005):抛出了“ System.Web.httpexception”类型的例外。 ---> System.NullReferenceException:对象引用未设置为对象的实例。 出现错误的行是以下
var cookie = Request.Cookies[FormsAuthentication.FormsCookieName]
I found a Null Reference Exception in logs, related to a controller method. Is there any scenario that Request object can be null?
This is the error I am getting.
System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
The line which getting error is the following
var cookie = Request.Cookies[FormsAuthentication.FormsCookieName]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论