Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Web config

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bobby - 27 Sep 2007 23:20 GMT
have a web app where one page Default.aspx should be publicly accessable and
another Admin.aspx restricted to a certain local group.  When I am on
Default.aspx. There is link which suppose to take me Admin.aspx but I want
too give security to that page and always it jumps me to Login.aspx page.  
How can I do that.

How can I do this in a web.config? Can I specify different authorization
settings per file?
Chris Fulstow - 28 Sep 2007 00:55 GMT
>  have a web app where one page Default.aspx should be publicly accessable and
> another Admin.aspx restricted to a certain local group.  When I am on
[quoted text clipped - 4 lines]
> How can I do this in a web.config? Can I specify different authorization
> settings per file?

Hi Bobby

You can add these settings to you web.config:

<system.web>
   <authentication mode="Forms">
       <forms loginUrl="Login.aspx" />
   </authentication>
</system.web>

<location path="Admin.aspx">
   <system.web>
       <authorization>
           <deny users="?"/>
       </authorization>
   </system.web>
</location>

If you need different settings for other files then you can add more
<location> settings.

It's also possible to do the same thing using code, with something
like:

If Not User.IsInRole("Administrators") Then
   Response.Redirect("Login.aspx")
End If

Chris

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.