0

I want to validate my page to prevent HTML Injection attacks.

Some viruses, trojans etc. can detect and inject some code to your web site. And this can cause design of your web site can change or some malicious codes can be injected.

How can I validate my page is really my page that I create from server?

1
  • I don't try anything now. I just want to give some advice about it. I just think to keep my page structure somewhere and check it from there. If you have better idea, please share it :) Commented Oct 7, 2013 at 8:43

1 Answer 1

1

You can set validateRequest to true, which is default

<configuration>
  <system.web>
    <pages validateRequest="true" />
  </system.web>
</configuration>

And always encode user input:

Server.HtmlEncode("<script>unsafe</script>");

For more information:

Request Validation - Preventing Script Attacks

HtmlEncode, HtmlDecode

Sign up to request clarification or add additional context in comments.

1 Comment

I don't mean just malicious codes. I want to validate my page structure from top to bottom. I don't want anything injected. If you have any experience about malicious programs, you can understand me well. They can inject what they want. But I want to validate my page to inform users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.