asp.net – IIS 7 UrlReferrer抛出异常
发布时间:2020-12-16 09:50:11 所属栏目:asp.Net 来源:网络整理
导读:当我获得引荐来源网址时,IIS 7会抛出异常.我的代码是这样的: var referrer = Request.UrlReferrer == null ? null : Request.UrlReferrer.AbsoluteUri; 应用程序抛出带有错误消息的ArgumentException, “Value does not fall within the expected range.”
当我获得引荐来源网址时,IIS 7会抛出异常.我的代码是这样的:
var referrer = Request.UrlReferrer == null ? null : Request.UrlReferrer.AbsoluteUri; 应用程序抛出带有错误消息的ArgumentException,
IIS 6中没有问题. 使用“Response.Redirect”导航页面时会发生此异常 应用程序主页根据当前用户的角色具有Response.Redirect方法.用户主页面抛出此异常. 如何在IIS 7中获取Referrer URL. 谢谢, 解决方法
当我尝试从请求处理中启动的System.Threading.Task访问请求对象时遇到类似的问题.
我正在使用该任务来减少响应时间 – 在我的情况下,大多数处理可以在发送请求后执行. 也就是说,我有类似的东西: public ActionResult SomeAction() { new System.Threading.Task(() => { // here I used this.Request.UrlReferrer and got weird ArgumenException error }).Start(); return someActionResultThatDoesntRequireProcessing; } 我已将UrlReferrer(以及我需要的其他this.Request.stuff)在延迟处理中提取到一个单独的“闭包”变量中(我选择它们来获得非常基本的类型): public ActionResult SomeAction() { var urlReferrerAbs = this.Request.UrlReferrer.AbsoluteUri; var clientAddress = this.Request.UserHostAddress; // save other stuff from the request object new System.Threading.Task(() => { // here I used urlReferrerAbs instead of this.Request.UrlReferrer and the error has gone! }).Start(); return someActionResultThatDoesntRequireProcessing; } 这对我有用. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 350错误:’blah.blah.blah’类型已包含定义
- asp.net – GET与POST真的很重要吗?
- asp.net-mvc – 使用Dotnetopenauth的自定义配置文件提供程
- .NET Standard项目构建失败,消息无用
- asp.net-core-mvc – 在Mvc6中,WriteAsync函数在哪里?
- asp.net – NLogConfigurationException – 从’System.Str
- asp.net-mvc – 用户经常注销(默认会员提供商)
- 如何在ASP.NET MVC应用程序中组织JavaScript代码
- asp.net-mvc – ASP.NET MVC:BLL和DAL到Repository设计
- asp.net – 点击按钮禁用
推荐文章
站长推荐
- asp.net-mvc – 使用ASP.NET MVC的基础认证
- asp.net-membership – 使用SQL提供程序获取ASP.
- asp.net网站 – 自动添加版本号?
- asp.net-mvc – ASP.NET MVC6中的实体框架7多个外
- asp.net-mvc-3 – 如何在带有剃刀的asp.net mvc3
- asp.net-mvc – 模拟DataServiceQuery
- asp.net – WebForms身份验证作为MVC过滤器
- asp.net-mvc – 是否可以模拟/伪造扩展方法?
- asp.net-mvc – ASP.NET MVC推荐的依赖注入框架是
- asp.net-mvc-3 – 如何在Razor视图引擎中注册程序
热点阅读