Wednesday, March 2, 2011

How to solve “HTTP Error 400 - Bad Request” in ASP.NET

URL is invalid.
Double Check URL if any invalid character in the path portion of a URL, such as: <,>,*,%,&,:,\,?
Reference:

Email Address validation for a Textbox by Regular Expressionvalidator in ASP.NET

            <asp:TextBox ID="TextboxEmailAddress" runat="server" Width="200px"></asp:TextBox>&nbsp;*
            <asp:RegularExpressionValidator ID="RegularExpressionValidatorEmailAddress" runat="server" ControlToValidate="TextboxEmailAddress" ValidationExpression="^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$" Display="Dynamic"  ErrorMessage="Invalid Email address"></asp:RegularExpressionValidator>

Register your HTTP modules at runtime without config

From David Ebbo, Architect on the ASP.NET team

How to create a link just for running Javascript, no postback

Two ways
<a href="#" onclick="Function();">Click to Run</a>
<a href="javascript:void(0)" onclick=" Function ();">Click to Run </a>