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 8999745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:13:15+00:00 2026-06-16T00:13:15+00:00

.NET 4.0 VS 2012 IIS 7 I have an app that takes in email

  • 0

.NET 4.0
VS 2012
IIS 7

I have an app that takes in email addresses on various pages, and I’m finding that users are copy/pasting directly into a few inputs and it’s triggering the error mentioned in the title, here’s an example.

"blah blah" <blah@blah.com>

Obviously the brackets are triggering the problem. I realize I can simply switch the validation to 2.0, but I would prefer not doing that, so here are my question(s).

  • Is there a way to have the runtime react better? When this is encountered, instead of throwing up an uber scary page it treats it as an input error and displays a message to the user (in the general case) For example, in scenario I’m speaking of, I could display an error message about < and > not being allowed in email addresses. I like the protection, but I dislike the idea that the ‘oops’ page is shown everytime someone enters input that’s potentially dangerous.

  • If I were to relax the validation:

    • Can I do it on a per page basis? I don’t believe so, but I’m asking for completeness
    • What tools does ASP.NET give me to protect myself against these types of issues manually? I really don’t want to get into the game of writing stuff to look over the input for potentially dangerous things.
  • 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-06-16T00:13:16+00:00Added an answer on June 16, 2026 at 12:13 am

    You can relax your validation on a per page basis by putting ValidateRequest=”false” in the page heading.

    You can then use a regular expression to validate the email address, like this:

    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
    ControlToValidate="Email" ErrorMessage="Enter a valid e-mail address" 
    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
    

    For other controls you could use the regular expression “^[^<>]+$” to check for angle brackets. In reality, you don’t need to worry about “potentially dangerous” user input unless you’re outputting it to the client (HTML / JavaScript), or you’re including it in an SQL statement.

    Alternatively, you could try to write a page level error handler in your page or an application level error handler in Global.asax.

    Page level error handling: http://msdn.microsoft.com/en-us/library/ed577840(v=vs.100).aspx

    Application level error handling:
    http://msdn.microsoft.com/en-us/library/24395wz3(v=vs.100).aspx

    This page gives some useful info about disabling request validation in ASP.NET:
    http://msdn.microsoft.com/en-us/library/hh882339(v=vs.100).aspx

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

Sidebar

Related Questions

I have a (.NET) application that calls a PHP app, residing on a different
I have an ASP.NET Web API application running on my local instance of IIS.
I have my ASP.NET site generated from Web Forms template in Visual Studio 2012.
I have a .NET application that I am trying to debug and part of
I am modifying some CSS code that I got from http://tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/ . It is
I have an ASP.NET MVC intranet site that uses Windows Authentication (Kerberos) exclusively with
I have a C# Web app that runs perfectly fine in VS2010, but when
I'm working on a web app in ASP.NET 2.0 that involves serving images via
I did something similar to: http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/ and just like the original it works in
I'm running Visual Studio 2012 RC with the .Net 4.5 bits with T4MVC. I'm

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.