Programmatic access to web.config's <system.web> elements??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MikeM

    Programmatic access to web.config's <system.web> elements??

    I've been trying to locate some property or method that will allow
    programmatic access to the "loginUrl" attribute in the web.config file in the
    <system.web> -> <authentication > element when the config file is set up for
    Forms Authentication. I know certain system.web settings get mapped to
    various properties/methods during runtime (e.g. <sessionState>' s timeout
    attribute maps to the Session.Timeout property at runtime). You can easily
    access the "name" and "path" attributes for FormsAuthentica tion via the
    "FormsCookieNam e" and "FormsCookiePat h" properties, but there is no
    "LoginUrl" property. I've looked in several other places, but I can't find
    anything that gives me access to that. The only way I've been able to
    programmaticall y access that is to load the entire web.config file into an
    XmlDocument and then use XPath to access that element/attribute. That
    doesn't seem like a "clean" way to go about this and since so many other
    web.config properties are available at runtime, I don't see why loginUrl
    should not also be easily available. Any ideas?

    Thanks!

    -Mike
  • Brock Allen

    #2
    Re: Programmatic access to web.config's &lt;system.web& gt; elements??

    FormsAuthentica tion.LoginUrl

    -Brock
    DevelopMentor



    [color=blue]
    > I've been trying to locate some property or method that will allow
    > programmatic access to the "loginUrl" attribute in the web.config file
    > in the <system.web> -> <authentication > element when the config file
    > is set up for Forms Authentication. I know certain system.web
    > settings get mapped to various properties/methods during runtime (e.g.
    > <sessionState>' s timeout attribute maps to the Session.Timeout
    > property at runtime). You can easily access the "name" and "path"
    > attributes for FormsAuthentica tion via the "FormsCookieNam e" and
    > "FormsCookiePat h" properties, but there is no "LoginUrl" property.
    > I've looked in several other places, but I can't find anything that
    > gives me access to that. The only way I've been able to
    > programmaticall y access that is to load the entire web.config file
    > into an XmlDocument and then use XPath to access that
    > element/attribute. That doesn't seem like a "clean" way to go about
    > this and since so many other web.config properties are available at
    > runtime, I don't see why loginUrl should not also be easily available.
    > Any ideas?
    >
    > Thanks!
    >
    > -Mike
    >[/color]



    Comment

    • MikeM

      #3
      Re: Programmatic access to web.config's &lt;system.web& gt; elements??

      Brock,

      Thanks for the response. Is FormsAuthentica tion.LoginUrl an ASP.NET 2.0
      feature? I see no mention of it in 1.0 or 1.1. I can't access that at all.

      -Mike

      "Brock Allen" wrote:
      [color=blue]
      > FormsAuthentica tion.LoginUrl
      >
      > -Brock
      > DevelopMentor
      > http://staff.develop.com/ballen
      >
      >
      >[color=green]
      > > I've been trying to locate some property or method that will allow
      > > programmatic access to the "loginUrl" attribute in the web.config file
      > > in the <system.web> -> <authentication > element when the config file
      > > is set up for Forms Authentication. I know certain system.web
      > > settings get mapped to various properties/methods during runtime (e.g.
      > > <sessionState>' s timeout attribute maps to the Session.Timeout
      > > property at runtime). You can easily access the "name" and "path"
      > > attributes for FormsAuthentica tion via the "FormsCookieNam e" and
      > > "FormsCookiePat h" properties, but there is no "LoginUrl" property.
      > > I've looked in several other places, but I can't find anything that
      > > gives me access to that. The only way I've been able to
      > > programmaticall y access that is to load the entire web.config file
      > > into an XmlDocument and then use XPath to access that
      > > element/attribute. That doesn't seem like a "clean" way to go about
      > > this and since so many other web.config properties are available at
      > > runtime, I don't see why loginUrl should not also be easily available.
      > > Any ideas?
      > >
      > > Thanks!
      > >
      > > -Mike
      > >[/color]
      >
      >
      >
      >[/color]

      Comment

      • Brock Allen

        #4
        Re: Programmatic access to web.config's &lt;system.web& gt; elements??

        Oops, you're absolutely right... it is.

        -Brock
        DevelopMentor



        [color=blue]
        > Brock,
        >
        > Thanks for the response. Is FormsAuthentica tion.LoginUrl an ASP.NET
        > 2.0 feature? I see no mention of it in 1.0 or 1.1. I can't access
        > that at all.
        >
        > -Mike
        >
        > "Brock Allen" wrote:
        >[color=green]
        >> FormsAuthentica tion.LoginUrl
        >>
        >> -Brock
        >> DevelopMentor
        >> http://staff.develop.com/ballen[color=darkred]
        >>> I've been trying to locate some property or method that will allow
        >>> programmatic access to the "loginUrl" attribute in the web.config
        >>> file in the <system.web> -> <authentication > element when the config
        >>> file is set up for Forms Authentication. I know certain system.web
        >>> settings get mapped to various properties/methods during runtime
        >>> (e.g. <sessionState>' s timeout attribute maps to the Session.Timeout
        >>> property at runtime). You can easily access the "name" and "path"
        >>> attributes for FormsAuthentica tion via the "FormsCookieNam e" and
        >>> "FormsCookiePat h" properties, but there is no "LoginUrl" property.
        >>> I've looked in several other places, but I can't find anything that
        >>> gives me access to that. The only way I've been able to
        >>> programmaticall y access that is to load the entire web.config file
        >>> into an XmlDocument and then use XPath to access that
        >>> element/attribute. That doesn't seem like a "clean" way to go about
        >>> this and since so many other web.config properties are available at
        >>> runtime, I don't see why loginUrl should not also be easily
        >>> available. Any ideas?
        >>>
        >>> Thanks!
        >>>
        >>> -Mike
        >>>[/color][/color][/color]



        Comment

        Working...