Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can anybody help me. i have some files that can access by user after login. But problem with that user can enter direct url and that page he can access so how to restrict that user from entering into the page without login..if user copy url of page without login then it should redirect to login page..
Posted

You need to learn something about basic ASP.NET authentication. Here are 2 good resources.

http://msdn.microsoft.com/en-us/library/xdt4thhy(v=vs.100).aspx[^]

http://msdn.microsoft.com/en-us/library/ee817643.aspx[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-Oct-12 16:05pm    
Well, appropriate resources, a 5.
--SA
fjdiewornncalwe 16-Oct-12 16:11pm    
Thanks, Sergey
ridoy 16-Oct-12 16:06pm    
+5
fjdiewornncalwe 16-Oct-12 16:11pm    
Thanks, ridoy.
Wonde Tadesse 16-Oct-12 19:38pm    
5+
The best way is to implement membership Introduction to Membership[^] which both makes it easy to add login (and related matters) but also handles the redirection for you.

You create a web.config in a folder that forbids access to unauthorized users - it's one line of xml - and it forbids all access to file in that folder or subfolders. Easy!
 
Share this answer
 
Comments
ridoy 16-Oct-12 16:06pm    
+5
Wonde Tadesse 16-Oct-12 19:38pm    
5+
Look into Form authentication and Authorization. Create a folder and put all resource inside the folder which you want only for logged in users. Protect that folder in Web.Config file:

Look into Form authentication and Authorization. Create a folder and put all resource inside the folder which you want only for logged in users. Protect that folder in Web.Config file:
HTML
<location path="[Your folder name]">
	<system.web>
		<authorization>
			<deny users="?" />
		</authorization>
	</system.web>
</location>
 
Share this answer
 
v2
Comments
Member 9334390 17-Oct-12 13:23pm    
i doesn't know <deny users="?"> is syntax or somthing related to folder

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