Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6238465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:13:08+00:00 2026-05-24T11:13:08+00:00

What is the best way to sanitize the user input in asp.net mvc without

  • 0

What is the best way to sanitize the user input in asp.net mvc without throwing “potentially dangerous request.form” exception and still preventing the xss attack for the post requests which contains dangerous tags.

Edit:
I tried the AntiXss and created custom encoder which encodes all the submitted values at runtime but the problem is that it is still throwing the exception. Actually I am not figuring out that exactly where (which event) I can ensure that the request contains nothing dangerous and if it contains something dangerous, I can redirect it to another Action rather than throwing exception.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:13:09+00:00Added an answer on May 24, 2026 at 11:13 am

    Disable the automatic form checking, and use Microsoft Anti-Cross Site Scripting Library to manually check each relevant field for XSS.

    Of course, in MVC some of the checks come out of the box. If, for example, your action method contains an int parameter called productID, and the user submits a form with a productID field, it’s automatically populated by MVC’s model binder mechanism and you get a “strong” int which you can count on. No text inside, no problems.
    So all you have to check are the text-based fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to sanitize $_GET[''] request? I want to allow downloading
Which is the best way to sanitize content? An example... Example - Before sanitize:
Possible Duplicate: Best way to stop SQL Injection in PHP How do I sanitize
What is the best way to sanitize message content on the server side which
Whats the best way to authenticate and check the strings that a user enters
Best way to allow the User to define a Table’s Order? We are using
Best way to manage user requests for reading too many rows from a table
any best way to debug exception unless using logcat since the overall code are
What is the best way to sanitize an attribute value in rails? The code
What's the best way to sanitize the callback for jsonp? I currently have something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.