Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
Hello Friends,
i sue formauthertication in my application and i use login button in index page for control panel for admin user. but my most page are public.
when i run my application
<authentication mode="Forms">
     <forms loginUrl="~/Public/frmLogin.aspx" name="Egyan"   />
     <deny users="?"/>
its directly goes to login page with return url instead of index page.

please help me.
Posted 8-Jan-13 22:54pm
Aman.A at 9-Jan-13 9:43am
did you set your start page in Visual Studio? right click on the page in your Visual Studio solution and click on "set as start page" and see if that solves your problem.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Kindly use the following code. It may help.
Here "loginUrl" is the redirect url that will work only for those pages which need authentication. Onthe other hand the "defaultUrl" will allow the user to visit the normal pages. Here in my code the .aspx pages inside the admin folder of the root directory will be asked to login, if anyone requests any page in admin section.
    <compilation debug="true" targetFramework="4.0" />
    <authentication mode="Forms">
      <forms timeout="30" loginUrl="login.aspx" defaultUrl="default.aspx" />
  <location path="admin">
        <deny users="?" />

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

  Print Answers RSS
0 Abhinav S 155
1 Mika Wendelius 151
2 Sergey Alexandrovich Kryukov 135
3 TheRealSteveJudge 114
4 Peter Leow 110
0 Sergey Alexandrovich Kryukov 8,613
1 OriginalGriff 6,536
2 Peter Leow 3,727
3 Zoltán Zörgő 3,456
4 Richard MacCutchan 2,442

Advertise | Privacy | Mobile
Web01 | 2.8.150123.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100