Controlling Page Access in .aspx page

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Controlling Page Access in .aspx page

    I am building some .NET classes and pages that will be part of an existing
    classic ASP app. The ASP app uses cookies to store login information for
    administrators. I have one include file that checks to see if the user is a
    logged in administrator, and if not, redirects to a login page. I then
    include this file in all ASP pages I do not want non-administrators to be
    able to access.

    I want to be able to do the same type of thing with .ASPX pages. I know I
    could easily do this with a base page and by setting a property
    "LoginRequired" or something of the like, and then checking a cookie and
    redirecting in the BasePage class, but I do not want this to be something
    that is in the code-behind. I'd like to be able to set some sort of value on
    the actual .ASPX page and have the BasePage class check that instead. This
    way I can make changes on the fly if need be without having to recompile code.

    Any ideas?
    Shawn Berg Guest

  2. Similar Questions and Discussions

    1. Accessing a aspx page using HttpWebRequest from another aspx page on the same webapp
      Did you have any luck on this as I have the same problem. Maybe you can help me out of you solved your problem.
    2. Transfer from an ASP Page to an ASPX Page
      You can not use ASP session in ASP.NET and vice versa. Submit all the session values in ASP as a querystring to the ASPX page. This is the only...
    3. problems to access an aspx page in intranet
      > people i have a litte problem with my .NET web proyect. (watch the wrapping)...
    4. redirecting from .aspx page to .asp page
      There is no great way to share session state between ASP and ASP.NET. But that doesn't mean you don't have options. Here are some common ways:...
    5. how to interact client script within aspx page to other page functions, etc.? PLEASE!!!
      Hi, I've spent all day trying to find some info on this...please help! I have an aspx page with an xmlDocument (not dataset/relational db) with...
  3. #2

    Default Re: Controlling Page Access in .aspx page

    Shawn,

    not quite what you are asking about, but check out, todo, and
    see the snippet below. It migth help you out.

    --

    Best regards,
    Geir Aamodt
    geir.aamodt(AT)bekk.no

    --------- Snippet start---------
    Partition Your Web Site
    Separate the public and restricted access areas of your Web site. Place your
    application's logon page and other pages and resources that should only be
    accessed by authentication users in a separate folder from the public access
    areas. Protect the restricted subfolders by configuring them in IIS to
    require SSL access, and then use <authorization> elements to restrict access
    and force a login. For example, the following Web.config configuration
    allows anyone to access the current directory (this provides public access),
    but prevents unauthenticated users from accessing the restricted sub folder.
    Any attempt to do so forces a Forms login.

    <system.web>
    <!-- The virtual directory root folder contains general pages.
    Unauthenticated users can view them and they do not need
    to be secured with SSL. -->
    <authorization>
    <allow users="*" />
    </authorization>
    </system.web>

    <!-- The restricted folder is for authenticated and SSL access only. -->
    <location path="Restricted" >
    <system.web>
    <authorization>
    <deny users="?" />
    </authorization>
    </system.web>
    </location>
    --------- Snippet end---------

    "Shawn Berg" <ShawnBerg@discussions.microsoft.com> wrote in message
    news:9E9ACD0E-5C66-421A-B00A-28A622783EDA@microsoft.com...
    >I am building some .NET classes and pages that will be part of an existing
    > classic ASP app. The ASP app uses cookies to store login information for
    > administrators. I have one include file that checks to see if the user is
    > a
    > logged in administrator, and if not, redirects to a login page. I then
    > include this file in all ASP pages I do not want non-administrators to be
    > able to access.
    >
    > I want to be able to do the same type of thing with .ASPX pages. I know I
    > could easily do this with a base page and by setting a property
    > "LoginRequired" or something of the like, and then checking a cookie and
    > redirecting in the BasePage class, but I do not want this to be something
    > that is in the code-behind. I'd like to be able to set some sort of value
    > on
    > the actual .ASPX page and have the BasePage class check that instead. This
    > way I can make changes on the fly if need be without having to recompile
    > code.
    >
    > Any ideas?

    Geir Aamodt Guest

  4. #3

    Default Re: Controlling Page Access in .aspx page

    Looks like I forgot to replace my "todo" with the link to
    the page containing the snippet.

    Sorry about that, here are the link:
    [url]http://msdn.microsoft.com/library/en-us/dnnetsec/html/THCMCh19.asp[/url]

    --

    Best regards,
    Geir Aamodt
    geir.aamodt(AT)bekk.no

    "Geir Aamodt" <geir.aamodt(AT)bekk.no> wrote in message
    news:OizPoIEGFHA.3472@TK2MSFTNGP09.phx.gbl...
    > Shawn,
    >
    > not quite what you are asking about, but check out, todo, and
    > see the snippet below. It migth help you out.
    >
    > --
    >
    > Best regards,
    > Geir Aamodt
    > geir.aamodt(AT)bekk.no
    >
    > --------- Snippet start---------
    > Partition Your Web Site
    > Separate the public and restricted access areas of your Web site. Place
    > your application's logon page and other pages and resources that should
    > only be accessed by authentication users in a separate folder from the
    > public access areas. Protect the restricted subfolders by configuring them
    > in IIS to require SSL access, and then use <authorization> elements to
    > restrict access and force a login. For example, the following Web.config
    > configuration allows anyone to access the current directory (this provides
    > public access), but prevents unauthenticated users from accessing the
    > restricted sub folder. Any attempt to do so forces a Forms login.
    >
    > <system.web>
    > <!-- The virtual directory root folder contains general pages.
    > Unauthenticated users can view them and they do not need
    > to be secured with SSL. -->
    > <authorization>
    > <allow users="*" />
    > </authorization>
    > </system.web>
    >
    > <!-- The restricted folder is for authenticated and SSL access only. -->
    > <location path="Restricted" >
    > <system.web>
    > <authorization>
    > <deny users="?" />
    > </authorization>
    > </system.web>
    > </location>
    > --------- Snippet end---------
    >
    > "Shawn Berg" <ShawnBerg@discussions.microsoft.com> wrote in message
    > news:9E9ACD0E-5C66-421A-B00A-28A622783EDA@microsoft.com...
    >>I am building some .NET classes and pages that will be part of an existing
    >> classic ASP app. The ASP app uses cookies to store login information for
    >> administrators. I have one include file that checks to see if the user is
    >> a
    >> logged in administrator, and if not, redirects to a login page. I then
    >> include this file in all ASP pages I do not want non-administrators to be
    >> able to access.
    >>
    >> I want to be able to do the same type of thing with .ASPX pages. I know I
    >> could easily do this with a base page and by setting a property
    >> "LoginRequired" or something of the like, and then checking a cookie and
    >> redirecting in the BasePage class, but I do not want this to be something
    >> that is in the code-behind. I'd like to be able to set some sort of value
    >> on
    >> the actual .ASPX page and have the BasePage class check that instead.
    >> This
    >> way I can make changes on the fly if need be without having to recompile
    >> code.
    >>
    >> Any ideas?
    >
    >

    Geir Aamodt Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139