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. Advertising

  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. Advertising

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:
    550
    Hermit Dave
    Jan 13, 2004
  2. Hermit Dave
    Replies:
    0
    Views:
    457
    Hermit Dave
    Jan 13, 2004
  3. Murphy
    Replies:
    2
    Views:
    4,369
    hwang
    Apr 19, 2004
  4. gabe

    How to read Forms LoginURL?

    gabe, Nov 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    352
  5. Alexey Smirnov

    Re: <forms loginUrl="https:// pb

    Alexey Smirnov, Jun 25, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    605
    Alexey Smirnov
    Jun 25, 2009
Loading...

Share This Page