.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

ASP.NET web application - Serverside validation of form field's data

Posted By: Venkat     Posted Date: September 13, 2009    Points:2   Category :ASP.Net
.
Hi,
We are building an ASP.NET application with C#.net as language.

Here we are validating the form field's data at client side using ASP.NET validation controls. Now we are planning to validate the form field's data at the server side too, to avoid script injections by hackers.

Would you please guide me on this, if you have an idea?

If would be great if you could also provide a reference document or web references (If needed).


Many Thanks,
Regards,
Venkat.
.

Responses
Author: Lakhan Pal Garg             
Posted Date: September 13, 2009     Points: 5   

Hi,
You can use Regular Expression to Validate at server side.

here is the example to validate email id at server side:

Regex regEmail = new Regex(@"^(([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)?(\.[a-zA-Z0-9_-]+))$");

regEmail.IsMatch("lakhangarg@gmail.com")


IsMatch will return Boolean value.

Thanks & Regards
Lakhan Pal Garg



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend