在IIS上承载的7.5只.NET 4.0安装了.NET 3.5的项目禁用ASP.NET请求验证(只是一个网页) [英] Disabling ASP.NET Request Validation (for just one page) in a .NET 3.5 project hosted on IIS 7.5 with only .NET 4.0 installed

查看:117
本文介绍了在IIS上承载的7.5只.NET 4.0安装了.NET 3.5的项目禁用ASP.NET请求验证(只是一个网页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用,我相当肯定ASP.NET web表单请求验证一个问题,就是下到我这里托管在IIS 7.5的.NET 3.5的项目(Windows 7的 - 本地开发机)。

I'm having a problem with request validation in ASP.NET webforms that I am fairly sure is down to me hosting a .NET 3.5 project on IIS 7.5 (Windows 7 - local development machine).

基本上我从外部站点接收回传(即完全是我的控制之外),并收到以下异常:

Essentially I'm receiving a postback from an external site (that is entirely outside of my control) and receiving the following exception:

A可能是从客户端检测到的危险值的Request.QueryString(DATA =< IDP MSGTYPE =认证...)。

我有这一套在页面声明:

I've got this set in the page declaration:

<%@ page language="C#" autoeventwireup="true" inherits="postexternal" enableviewstate="false" masterpagefile="~/SiteBase/transactional.master" Codebehind="postexternal.aspx.cs" validaterequest="false" %>

(另外我试过在web.config中/页将其关闭,以及 - 无济于事

(and additionally I've tried turning it off in web.config/page as well - to no avail.

我觉得这可能是做的(什么MS说)ASP.NET 4.0中做了重大更改,如下所述:
http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770147

I think that this may be to do with a breaking change made in (what MS say) ASP.NET 4.0, as described here: http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770147

但是,如果我补充一点,配置到我的web.config我得到一个配置错误(因为它在一个.NET 2.0的应用程序池运行)。

But if I add that configuration into my web.config I get a configuration error (as its running in a .NET 2.0 application pool).

无论怎样我期待我被困在目前这样将AP preciate任何指针/咨询人。反正我有可以解决这个任何其他方式?)。我可以尝试安装.NET 2.0,但我不知道,即使是去工作(并似乎pretty脆弱的方法来试试)。

Whichever way I look I'm stuck at the moment so would appreciate any pointers/advice people have. Is there anyway I can work around this any other way?). I could try to install .NET 2.0 but I'm not sure that is even going to work (and seems a pretty fragile method to try).

感谢。

推荐答案

我有这个问题太并将其加入到web.config解决了这个问题。

I had this issue too and adding this to the web.config resolved the issue.

<httpRuntime requestPathInvalidCharacters="" />

在默认情况下,.NET 4.0拒绝所有以&lt请求;> *%放大器;:\\?这可能会导致问题为你喜欢的人物是我。

By Default, .Net 4.0 rejects all requests with <>*%&:\? characters which may be causing the issue for you like it was for me.

[ConfigurationProperty("requestPathInvalidCharacters", DefaultValue=@"<,>,*,%,&,:,\,?")]
public string RequestPathInvalidCharacters { get; set; }

这篇关于在IIS上承载的7.5只.NET 4.0安装了.NET 3.5的项目禁用ASP.NET请求验证(只是一个网页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆