Forms Authentication LoginURL

6 views
Skip to first unread message

chuck

unread,
Apr 11, 2002, 12:56:11 PM4/11/02
to
Is there anyway to extract the LogInURL from the
web.config file by code. It is not accessible from the
class.

I found a way to kludge the timeout value out, but can't
get the LogInURL.


Private Function TimeOut_Get() As Integer
'Get formsauthentication TimeOut value
'Kludge, timeout property is not exposed in the class
FormsAuthentication.SetAuthCookie("Username",
False)
Dim ticket As FormsAuthenticationTicket =
FormsAuthentication.Decrypt(Response.Cookies
(FormsAuthentication.FormsCookieName).Value)
Dim ts As New TimeSpan(ticket.Expiration.Ticks -
ticket.IssueDate.Ticks)
Return ts.Minutes
End Function

[MS]Allen

unread,
Apr 12, 2002, 5:09:56 AM4/12/02
to
Try using WMI to retrieve the value of LoginUrl, like below:

string path = "root\\NetFrameworkV1:forms";
ManagementObject pm = new ManagementClass(path).CreateInstance();
pm["Selector"] = "config://localhost"; // represents the machine.config
file
pm.Get();
Response.Output.WriteLine("LoginUrl = {0}<br>", pm["loginUrl"]);

When you want to access an XML file directly, use the file selector
(selector ="file://<filename>'), however, for machine.config, it's
recommended to use the config://localhost instead.

HTH,

-Allen

Disclaimer:
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com
--------------------
Content-Class: urn:content-classes:message
From: "chuck" <nos...@crlf.com>
Sender: "chuck" <nos...@crlf.com>
X-Tomcat-NG: microsoft.public.dotnet.framework

chuck

unread,
Apr 15, 2002, 2:44:39 PM4/15/02
to
I get Access is denied on this line "pm = New
ManagementClass(path).CreateInstance()". I think some of
the objects aren't permitted to be looked at. localhost
is in the web.config file. was that the correct path?

Willy Denoyette [MVP]

unread,
Apr 15, 2002, 3:36:40 PM4/15/02
to
Did you try with impersonate="true" in your config file?
If you aren't impersonating, ASPNET is used to bind to WMI, IMO this account has no privilege to do so.


Willy.

"chuck" <nos...@crlf.com> wrote in message news:1daa01c1e4ad$992c58a0$9de62ecf@tkmsftngxs01...

Willy Denoyette [MVP]

unread,
Apr 16, 2002, 8:47:06 AM4/16/02
to
To give aspnet access to the NetFrameworkV1 WMI namespace, you have to change the WMI ACLs on the namespace and include the ASPNET
account.
To do this run Computer Management and Select "WMI Control" from "Services and Applications", in the WMI control properties dialog
select the Security tab and from the Treeview select Root\NetFrameworkV1, click the security button and add aspnet account to the
list and grant Execute methods and Remote Enable permissions.
When done you should have access to the WMI classes in NetFrameworkV1 from asp.net without impersonating.

Willy.

"Willy Denoyette [MVP]" <willy.d...@pandora.be> wrote in message news:e8tSmTL5BHA.972@tkmsftngp05...

Reply all
Reply to author
Forward
0 new messages