Re: How to read Forms LoginURL?

Discussion in 'ASP .Net' started by Daniel Fisher\(lennybacon\), Nov 30, 2005.

  1. string _loginUrl = "/login.aspx";


    System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
    doc.Load(HttpContext.Current.Request.PhysicalApplicationPath +
    "web.config");

    System.Xml.XmlNode node =
    doc.SelectSingleNode("/configuration/system.web/authentication/forms");
    if(node!=null)
    {
    if(node.Attributes["loginUrl"]!=null)
    {
    _loginUrl = node.Attributes["loginUrl"].Value;
    }
    }

    --
    Daniel Fisher(lennybacon)
    http://www.lennybacon.com


    "gabe" <> wrote in message
    news:...
    > Is there a way to read the loginURL attribute of the forms element in
    > the web.config file?
    >
    > We have a standard Login.aspx page we use for custom authentication.
    > When the site is down for maintenance, we'd like to just change this
    > parameter to "maintance.aspx". In our base page class we'd like to read
    > from the cache based on the value that is set in the web.config. If the
    > user is logged in and the loginURL is Maintenance.aspx, we'd like to
    > SignOut and existing users and tranfer them to the maintenance page.
    >
    > Has anyone dealt with this before? Thanks for your help.
    >
    > Gabe
    >
     
    Daniel Fisher\(lennybacon\), Nov 30, 2005
    #1
    1. Advertisements

  2. Daniel Fisher\(lennybacon\)

    gabe Guest

    Thank you! That's exactly what I was looking for.



    Daniel Fisher(lennybacon) wrote:
    > string _loginUrl = "/login.aspx";
    >
    >
    > System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
    > doc.Load(HttpContext.Current.Request.PhysicalApplicationPath +
    > "web.config");
    >
    > System.Xml.XmlNode node =
    > doc.SelectSingleNode("/configuration/system.web/authentication/forms");
    > if(node!=null)
    > {
    > if(node.Attributes["loginUrl"]!=null)
    > {
    > _loginUrl = node.Attributes["loginUrl"].Value;
    > }
    > }
    >
    > --
    > Daniel Fisher(lennybacon)
    > http://www.lennybacon.com
    >
    >
    > "gabe" <> wrote in message
    > news:...
    > > Is there a way to read the loginURL attribute of the forms element in
    > > the web.config file?
    > >
    > > We have a standard Login.aspx page we use for custom authentication.
    > > When the site is down for maintenance, we'd like to just change this
    > > parameter to "maintance.aspx". In our base page class we'd like to read
    > > from the cache based on the value that is set in the web.config. If the
    > > user is logged in and the loginURL is Maintenance.aspx, we'd like to
    > > SignOut and existing users and tranfer them to the maintenance page.
    > >
    > > Has anyone dealt with this before? Thanks for your help.
    > >
    > > Gabe
    > >
     
    gabe, Nov 30, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hermit Dave
    Replies:
    9
    Views:
    812
    Hermit Dave
    Jan 13, 2004
  2. Hermit Dave
    Replies:
    0
    Views:
    588
    Hermit Dave
    Jan 13, 2004
  3. Murphy
    Replies:
    2
    Views:
    4,602
    hwang
    Apr 19, 2004
  4. TJS
    Replies:
    6
    Views:
    635
  5. =?Utf-8?B?ZGdhdG9y?=

    Multiple LoginURL's

    =?Utf-8?B?ZGdhdG9y?=, Jun 14, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,731
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Jun 14, 2005
  6. gabe

    How to read Forms LoginURL?

    gabe, Nov 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    491
  7. Marco Roello

    ssl with <forms authentication> and loginurl problem

    Marco Roello, Jul 21, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    269
    Marco Roello
    Jul 21, 2003
  8. Eric
    Replies:
    2
    Views:
    946
Loading...