ASP.NET Regular Expression for date format

In ASP.Net Many times required to Validate Date Fromat Enter in Control.
in Regular Expression Following RE used to Validate Date Format.


dd/mm/yyyy Format In regular Expression    (optional mm,optional dd)
([1-9]|0[1-9]|[12][0-9]|3[01])[- /.]([1-9]|0[1-9]|1[012])[- /.][0-9]{4}$


mm/dd/yyyy   (optional mm,optional dd)
^([1-9]|0[1-9]|1[012])[- /.]([1-9]|0[1-9]|[12][0-9]|3[01])[- /.][0-9]{4}$

mm/dd/yyyy  (Exact Format)
^([01]\d)/([0-3]\d)/(\d{4})$


Prev Post                                                      All Post                                                           Next Post

Posted in | 3 comments

Invalid postback or callback argument,Asp.Net 2.0

Problem :-

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


Solution :-


It’s Common Problem With Asp.Net 2.0 (Microsoft Professional Edition,Beta Version Not Give an Error.) To Solve This Problem What You Have to Do Just Write Following Code in Web.Config.
<system.web>
<
pages enableEventValidation="false"/>
system.web>
Doing this One It’s Solve Your Problem But It’s Effect On Your Site Security. Basically EnableeventValidation of asp.Net pages are ture.Wich Prevent Injection Attack.Make it’s False Involve This Injection Attack.

Prev Post                                                      All Post                                                           Next Post

Posted in | 2 comments