Tuesday, 15 February 2011

c# - Login to view the Images in the Folder -



c# - Login to view the Images in the Folder -

i have mvc project url hostname/xxxx , have folder name called xxxx .

if come in url hostname/xxxx means straight go folder want go code controller

without login images should not viewed.

also without login means url should redirected.

without login images should not viewed.

i assume using form authentication. otherwise, method won't work.

create web.config file within xxxx folder place next authorization within web.config file

it restricts anonymous users accessing files within xxxx folder.

<?xml version="1.0"?> <configuration> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </configuration>

note: should not utilize approach restricting controller in asp.net mvc.

c# asp.net .net asp.net-mvc c#-4.0

No comments:

Post a Comment