Safe your Login info Guard Against Request !!

August 24, 2009 at 7:06 am Leave a comment

Use the method in your User textbox and Password textbox

As like::
String loginID = GuardAgainstRequest(tbxUserID.Text.Trim());
String loginPass =GuardAgainstRequest(tbxPass.Text.Trim());

public static string GuardAgainstRequest(string reqString)
{
if (reqString != null)
{
string[] strToReplace = {“select”, “drop”, “update”, “delete”, “xp_”, “insert”, “–”, “;”, “\”", “=”, “/”, “\\”, “()”, “^”, “~”, “`”, “‘”, “””};

for (int i =0; i < strToReplace.Length; i++)
{
if (strToReplace[i] == “–”)
{
reqString = reqString.Replace(strToReplace[i], “..”);
}
else if (strToReplace[i] == “‘”)
{
reqString = reqString.Replace(strToReplace[i], “””);
}
else
{
reqString = reqString.Replace(strToReplace[i], “?”);
}
}
return reqString;
}
else
{
return null;
}
}

Advertisement

Entry filed under: asp.net, C#, MSSQL SERVER. Tags: .

Get first day and last day year in C# .net Email Trace – Email Tracking

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

August 2009
M T W T F S S
« Jul   Oct »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Follow

Get every new post delivered to your Inbox.