English 中文(简体)
文本箱的验证
原标题:Textbox validation forcing error

视像网络制作人Vista,2010年,c#,p.net,网络版。 带有剪辑5号的操作方案。 我是有史以来唯一将实施这一方案的人......,它只能使用当地数据库在我的手提电脑上运行。

Writing app to download web pages, view them, (do some analysis), log some results. I found code to download pages - works well. I then set the text property of a textbox equal to the string contents of the page. That part also works. Then I went to run the code again, BUT the contents of the textbox gets validated and results in an error message.

A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$tbPageContents="
<!DOCTYPE HTML PUBLI..."). 

只要我没有在案文箱中展示结果,我就能够无问题地操作该守则。 我尝试了两种不同的解决办法:

  1. 我在文本箱中尝试了“false”属性......这让我看到了该法典的第一部分,但由于文本箱无法使用,我可以 up倒,看档案。 因此,这并没有真正解决问题。

  2. 我试图在网页指令和系统中确认Request=“false”。 http://www.asp.net/learn/whitepapers/request-validation”rel=“nofollow”http://www.asp.net/learn/whitepapers/request-validation,但只要我能告诉它,就没有效果。 这就是说,我仍然有错误。

  3. 在我将其放在案文框中之前,我尝试利用html对插图内容进行编码。 这样做是为了显示......,但它没有解决该问题在下一个问题上失败的问题。

  4. 我对发现错误和忽略错误进行了思考,但在执行我的编码之前,似乎就进行了验证。

我实际上不敢把这一页印在窗子上,以便进行分析,但如果我能够一劳永逸地看一看这个 st子,那将是非常有益的。 我只能从浏览器中找到一个页源。 我不敢肯定......也许会是这种偏好的解决办法。

我确实感到惊讶的是,选择第2号并不奏效,因为这似乎是所建议的解决办法。

我用的是:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="wan._Default" validateRequest="false" %>

是否还需要做些什么来阻止验证?

最佳回答

您还应使用<代码><http://www.untime requestValidationMode=“2.0”/>。 config文档。 这为伙伴关系提供了指导。 将验证模式改为2.0版。

https://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form- Value-was-detected- from-the-client”

问题回答

If this is .NET 4, you may also need to add <httpRuntime requestValidationMode="2.0" /> to your web.config





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签