By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,492 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,492 IT Pros & Developers. It's quick & easy.

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

P: n/a
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 FormsAuthentication via the
"FormsCookieName" and "FormsCookiePath" 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
programmatically 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
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
FormsAuthentication.LoginUrl

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 FormsAuthentication via the "FormsCookieName" and
"FormsCookiePath" 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
programmatically 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


Nov 19 '05 #2

P: n/a
Brock,

Thanks for the response. Is FormsAuthentication.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:
FormsAuthentication.LoginUrl

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 FormsAuthentication via the "FormsCookieName" and
"FormsCookiePath" 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
programmatically 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


Nov 19 '05 #3

P: n/a
Oops, you're absolutely right... it is.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Brock,

Thanks for the response. Is FormsAuthentication.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:
FormsAuthentication.LoginUrl

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 FormsAuthentication via the "FormsCookieName" and
"FormsCookiePath" 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
programmatically 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


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.