Click here to Skip to main content
12,947,250 members (49,212 online)
Rate this:
Please Sign up or sign in to vote.
I am using special character in asp textbox. but when i do any operation with another control like buttons, then at client level
Sys.WebForms.WebequestManager problem raise.

what i should i do to allow special character in asp textbox?

i already tried ValidateRequest="false" attribute with Page directive but
problem still there.
Posted 7-Jan-13 19:56pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You're using ASP.NET, not ASP. There is no such thing as an asp or textbox. It's just a HTML input control. I think you're saying you get an issue with using characters that look like a script injection.[^] explains how to turn on validation. Reverse the advice to turn it off. If you've tried all that, try posting code of what you've done, and the actual error message.
amit_83 8-Jan-13 2:27am
i have used fallowing string in textbox

I noticed that the email from gmail
are sent from the sender "codeproject Admin
<>". Why "ABC-admin"?
It should rather be "CPs-admin".
Christian Graus 8-Jan-13 2:49am
What email ? What text ?
Zafar Sultan 8-Jan-13 2:55am
Amit_83,why are you so very concerned about abc-admin or cps-admin? You don't own codeproject so whatever is the e-mail id they use(abc-admin, xyz-admin or thereisnoadmin) it has to do nothing with your problem. Why don't you stick to your problem rather that advicing what to use?
amit_83 8-Jan-13 3:47am
i have used whole text written below

I noticed that the email from gmail are sent from the sender "codeproject Admin <>". Why "ABC-admin"? It should rather be "CPs-admin".
Christian Graus 8-Jan-13 3:49am
I guess you just joined. The site sends you notifications. What makes you think I have control over what their format is ? Why do you care ?
amit_83 8-Jan-13 3:51am
My dear this is not an email sent from any where.
It just an example text i shown to you.

My question is if i use special charecter like <, >," sign
then Sys.WebForms.WebequestManager problem raise problem raise. what can i do to resolve this issue?
Christian Graus 8-Jan-13 3:56am
Oh - OK, that's very unclear. You do what I said. Go through that article, it shows all the places it should be turned on. Turn it off in all those places. Then, if you still have an error, show us the code and tell us the exact error message.
amit_83 8-Jan-13 4:04am
Thanks for reply.
But it did not work.
Christian Graus 8-Jan-13 4:06am
I don't know what to tell you. You're not being at all clear. You need to tell us what you did, and what 'it did not work' means. Because, somewhere your project is turning on this sort of validation. It's not happening by magic, and we can't say a spell to fix it. The info I linked to, is correct. You may look for an article that matches your version of .NET, but somehow, somewhere, you don't have this turned off, that's why it is doing what it is.
amit_83 8-Jan-13 4:38am
Thanks for reply, i will see once more.
but what i did
i have used <,>,"" character in my textbox, and i clicked on a button then Sys.WebForms.WebequestManager problem raise.
i turned off ValidateRequest="false" as suggest in the article you suggest, but it give me the problem at client end.

At client end Sys.WebForms.WebequestManager raise.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

A neat solution without turning requestvalidation to "off" is to use javascript. Suppose your textbox is "TextBox1" and on button("Button1") click event you want to perform server side operation follow the steps:
1) Include this script in head of your document:
  function ReplaceCharacter() {
   var value = (document.getElementById('TextBox1').value);
   value = value.replace('<', '< ;');//no space between < and ;
   value = value.replace('>', '> ;');//no space between > and ;
   document.getElementById('TextBox1').value = value;

2) In code behind write:

3) Wherever you want to get the value of textbox in server side code write:
string myString = Server.HtmlDecode(TextBox1.Text);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,059
CHill60 3,235
Maciej Los 2,538
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100