Server.HTMLEncode( txtMyCode.text )
Main Topics
Browse All TopicsI am using ASP.net to write a web-based code editor. I use the component asp:Textbox for typing code.
When I want to a file (e.g. aspx, html.......) to the server, a warning message: ".......potential dangerous ...save with "<" tag....." .
I think it should be the server setting problem. It seems that the server checking some special characters like <, > and block them. How can I disable this checking?
Pls help ~~
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Beware the security implications of "validateRequest=false".
Cross-site scripting. etc.
You should probably implement these checks in code anyway to be safe.
Adding Cross-Site Scripting Protection to ASP.NET 1.0
http://msdn.microsoft.com/
This applies in 1.1, too, if you disable validateRequest, or if you haven't updated 1.1 with certain hotfixes.
ASP.NET 1.1 Request Validation flaw
http://securecoder.com/New
Well,
when you save html files in database the HTML Encoded files will 100% safe to display in any browser
and internet browsers show the real text when you view the file not the html encoded like ">" will be shown like ">"
so suggest you go with security and ease of mind as it will work on any browser, any .Net version :)
Business Accounts
Answer for Membership
by: meet_zorrerPosted on 2004-01-30 at 22:32:27ID: 10241157
Well, You sould HTMLEncode your textbox contents before saving it to a file as the ">" will be converted to ">", but by doing
this you will only be able to show html files properly not the coding files like aspx,
also it is dangeros that you give users to create aspx file by there codings and save it to server for later execution