Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

Forms Authentication LoginURL

已查看 11 次
跳至第一个未读帖子

chuck

未读,
2002年4月11日 12:56:112002/4/11
收件人
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

未读,
2002年4月12日 05:09:562002/4/12
收件人
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

未读,
2002年4月15日 14:44:392002/4/15
收件人
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]

未读,
2002年4月15日 15:36:402002/4/15
收件人
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]

未读,
2002年4月16日 08:47:062002/4/16
收件人
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...

0 个新帖子