Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi...everyone.
can u help me,how to provide security to our website. Can u provide any sample code for this.
thank u.
Posted
Comments
Thanks7872 3-Jun-13 3:46am    
What do you mean by security?
[no name] 10-Jun-13 7:29am    
means:windows,forms and passport authentication modes in web.config.

You can add security in global.asax by checking URL in "Application_BeginRequest".

C#
string[] blacklist = new string{/*list of kewords like execute,.php,.html,<scripts>,</scripts>,alert*/};
            foreach (var item in blacklist)
	{
            if(Request.Url.AbsoluteUri.Contains(item))
                //redirect to login page
		 
	}


this code check url contains some unwanted and harmfull keywords to website like SQLInjection etc.

then you can create your own Role and User Management or user ASP.Net Membership for authentication on each page.
 
Share this answer
 
You need to learn about it before asking for sample code. If you are not clear what it means then sample code will be useless. Read this [LINK] to understand Security Basics and ASP.NEt support.
 
Share this answer
 
Comments
Sagar Kute 4-Jun-13 2:31am    
Dear Mr. Sudhakar Shinde, Please have a look on the link you have given, all the Security Basics which is given over there is also shortly mentioned by me, and additionally to this i have provided basic security for SQL-injection. So please don't waste your power to Answer Downvoted. thanks.
Sudhakar Shinde 4-Jun-13 3:20am    
Why do you think I will downvote your answer? BTW link is not accessible in your answer and that could be the reason someone has downvoted your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900