473,624 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading from text area throwing exception with <p>

propertyDescrip tion += "<br>" + lblpropertyDesc ription.Text; //here
i am reading some text from text area
i test wrting "p" in my text area it wrks fine but when i write
<pin my text area it gives the following error

Error Message:A potentially dangerous Request.Form value was detected from
the client (lblpropertyDes cription="
"). Stack Trace: at System.Web.Http Request.Validat eString(String s, String
valueName, String collectionName) at
System.Web.Http Request.Validat eNameValueColle ction(NameValue Collection nvc,
String collectionName) at System.Web.Http Request.get_For m() at
System.Web.UI.P age.GetCollecti onBasedOnMethod () at
System.Web.UI.P age.DeterminePo stBackMode() at
System.Web.UI.P age.ProcessRequ estMain() at
System.Web.UI.P age.ProcessRequ est() at
System.Web.UI.P age.ProcessRequ est(HttpContext context) at
System.Web.Call HandlerExecutio nStep.System.We b.HttpApplicati on+IExecutionSt ep.Execute()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynchr onously)
Aug 21 '06 #1
4 1672
Yup, that is what ASP.NET will give you.
Go to Google.
Type "A potentially dangerous Request.Form value was detected from "
into the search bar
and click search.

Tons of articles about this.
Vikas Kumar wrote:
propertyDescrip tion += "<br>" + lblpropertyDesc ription.Text; //here
i am reading some text from text area
i test wrting "p" in my text area it wrks fine but when i write
<pin my text area it gives the following error

Error Message:A potentially dangerous Request.Form value was detected from
the client (lblpropertyDes cription="
"). Stack Trace: at System.Web.Http Request.Validat eString(String s, String
valueName, String collectionName) at
System.Web.Http Request.Validat eNameValueColle ction(NameValue Collection nvc,
String collectionName) at System.Web.Http Request.get_For m() at
System.Web.UI.P age.GetCollecti onBasedOnMethod () at
System.Web.UI.P age.DeterminePo stBackMode() at
System.Web.UI.P age.ProcessRequ estMain() at
System.Web.UI.P age.ProcessRequ est() at
System.Web.UI.P age.ProcessRequ est(HttpContext context) at
System.Web.Call HandlerExecutio nStep.System.We b.HttpApplicati on+IExecutionSt ep.Execute()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynchr onously)

Aug 21 '06 #2
Can I do something like user should not be able to enter
html
i mean it should stop the user from entering <p>
instead of i write causes validation=fals e
"Ray Booysen" <rj***********@ rjb.za.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Yup, that is what ASP.NET will give you.
Go to Google.
Type "A potentially dangerous Request.Form value was detected from " into
the search bar
and click search.

Tons of articles about this.
Vikas Kumar wrote:
>propertyDescri ption += "<br>" + lblpropertyDesc ription.Text;
//here i am reading some text from text area
i test wrting "p" in my text area it wrks fine but when i write
<pin my text area it gives the following error

Error Message:A potentially dangerous Request.Form value was detected
from the client (lblpropertyDes cription="
"). Stack Trace: at System.Web.Http Request.Validat eString(String s,
String valueName, String collectionName) at
System.Web.Htt pRequest.Valida teNameValueColl ection(NameValu eCollection
nvc, String collectionName) at System.Web.Http Request.get_For m() at
System.Web.UI. Page.GetCollect ionBasedOnMetho d() at
System.Web.UI. Page.DetermineP ostBackMode() at
System.Web.UI. Page.ProcessReq uestMain() at
System.Web.UI. Page.ProcessReq uest() at
System.Web.UI. Page.ProcessReq uest(HttpContex t context) at
System.Web.Cal lHandlerExecuti onStep.System.W eb.HttpApplicat ion+IExecutionS tep.Execute()
at System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean&
completedSynch ronously)
Aug 21 '06 #3
Hi Vikas,

ASP.NET 1.1/2.0 by default enable requestValidati on so that any script or
html markup tags (like < , ....) will raise runtime exception. For your
scenario, I think you can consider the following options according to
what's the exact behavior you want and what task will your web page
designed to do:

1.If you want to let client users input html/xml markup tags in entry
fields(textbox, ...) and just want to display them again (write out), you
can simply disable the "validateReques t" for that particular page(which
will accept html markup input) and then on server-side, use
Server.HtmlEnco de or HttpUtility.Htm lEncode to encode the content in the
textbox. e.g

<%@ Page ............... ...... ValidateRequest ="false" %>

string safeString = Server.HtmlEnco de(TextBox1.Tex t);

Label1.Text = "<p>" + safeString + "</p">
2. Still turn on the "validateReques t", but peform valdation against the
Textbox's input content at client-side. For example, you can use a
customValidator control on the ASP.NET page to validate that certain
textbox in which the client user may input some html tags. And for the
custom Validator's client-side validation script, you can use javascript
function to check whether the input content contains those particular chars
(such as < , .....).

3. Use the Textbox's client-side "onchange" event to perform the content
checking, in this case, the script checking will be performed everytime
after the client-user modify the content in the textbox.

Here are some articles discussing on peform content validation against
textbox entry field through javascript, you can replace those script
function with your own ones according to your validation requirement:

#Client-Side Form Verification with JavaScript
http://www.webdevelopersnotes.com/ti...r_input_from_a
_text_box_html_ textarea_elemen t.php3

http://webdeveloper.internet.com/jav...rification.htm
l

#Using JavaScript to prevent or trigger form submission when ENTER is hit
http://www.cs.tut.fi/~jkorpela/forms/enter.html
#Checking/Validating Fields
http://www.irt.org/script/form.htm#5
Please feel free to let me know if there is anything unclear above or any
other information you wonder.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.


Aug 22 '06 #4
Hello Vikas,

Have you got any further ideas on this issue? If there is any other
questions or if you need any further assistance, please feel free to post
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3556
by: Derek Fountain | last post by:
When is the use of <xsl:text>blah blah</xsl:text> necessary? I'm finding that, although it's used religously in the book I'm learning from, if I miss it out, the output is just the same.
2
10555
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
2046
by: Gabe Moothart | last post by:
I would like to be able to dynamically change the attributes of an <area> element in an image map. The following works in IE 6 and Opera 7: <map name="Map1"> <area shape="rect" coords="10,10,100,50" href="foo.html" id="area1"> </map> .... <script> document.area1.href = "bar.html"; </script>
1
1703
by: Brad | last post by:
I've been trying to set the content of a div tag with a image map for example <div name='ImageMapLayer'> <map> <area></area> </map> </div> I've tried using both innerHTML and DOM. I can set it with DOM but sometimes the image map works and sometimes it doesn't. innerHTML
14
5579
by: laurence | last post by:
I am implementing a comprehensive image-map generator utility, so have been studying W3C HTML 4.01 Specification (http://www.w3.org/TR/html4/struct/objects.html#h-13.6) on image maps (among other things). I note the document specifies that block level content can be included within a <map>. Testing this in order to discover why one might wish to do this, I find the block level content is rendered in page flow order anyway, and not...
4
21423
by: PASQUALE | last post by:
Hi I have a question: do the both statements below give the same result? If yes then does somebody know something about preformance differencies using these joins? SELECT A.* FROM Table1 A INNER JOIN Table2 B on A.Field1 <> B.Field1
2
1813
by: Paul Verbelen | last post by:
I have a file with topics. I like to copy them in another file but want to have some blank lines between the different topics. I use <xsl:text> element with as data some blank lines to perform this. To clarify my question, I have add all the files required to perform the test. First question: Why doesn't this works anymore if I remove the line with "&#x00A0;" in the XSL-file ?
14
3135
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an explanation? Thanks, M. McDonnell
5
3981
by: ajos | last post by:
hi frnds, this is the way i ve written--> <html:text name="bdgtmastForm" property="publicity_code" size="5" maxlength="5"> but its giving me an error which seems irrelevent.. type Exception report message
10
13364
by: test9991014 | last post by:
Hi all, I have an <input type=texttag that is taking up too much space vertically. It's in a <tdthat has a fixed height, and I've set the height value in the <input>'s style to be 10px, less than the <td>'s height which is set to 14 using a normal "height=14" parameter. For some reason the <inputis taking up the entire vertical space of the <td>, which I know because I set <td bgcolor=red>. I can see the input area which is about 10...
0
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8330
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7153
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.