to saucer(思归, MS .NET MVP): 倒是能够出现登陆窗口,可是登陆不了,总是重复出现啊。咋办?
参考 HOWTO: Clear Logon Credentials to Force Reauthentication http://support.microsoft.com/default.aspx?scid=KB;en-us;q195192Re: How to provide Log Off for a Web Application? http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=e4XdGVs6CHA.1776%40TK2MSFTNGP10.phx.gbl&rnum=30
Private Sub Button1_Click() Dim chandLogonCookie As HttpCookie chandLogonCookie = Request.Cookies("ChangeLogin") Try If chandLogonCookie.Value <> "true" Then chandLogonCookie = New HttpCookie("ChangeLogin", "true") Response.Cookies.Add(chandLogonCookie) Else '//Ask IIS to authenticate the user if they are currently anonymous. '//This may allow a second request to succeed. Response.StatusCode = 401 Response.StatusDescription = "Unauthorized" lblMessage.Text = "<h2>You are not authorized to view this page</h2>" Response.Cookies("ChangeLogin").Value = "false" End If Catch chandLogonCookie = New HttpCookie("ChangeLogin", "false") Response.Cookies.Add(chandLogonCookie) '//Ask IIS to authenticate the user if they are currently anonymous. '//This may allow a second request to succeed. Response.StatusCode = 401 Response.StatusDescription = "Unauthorized" lblMessage.Text = "<h2>You are not authorized to view this page</h2>" End Try GetName() End Sub Private Sub GetName() txtName.Text = User.Identity.Name End Sub
to ynacc(ynacc),呵呵,是用來解決我的問題的. to saucer(思归, MS .NET MVP): How to do it concretely ? tks.
sorry, I haven't figured it out yet
if you felt it is annoying, suggest you try out the solution in HOWTO: Clear Logon Credentials to Force Reauthentication http://support.microsoft.com/default.aspx?scid=KB;en-us;q195192
倒是能够出现登陆窗口,可是登陆不了,总是重复出现啊。咋办?
HOWTO: Clear Logon Credentials to Force Reauthentication
http://support.microsoft.com/default.aspx?scid=KB;en-us;q195192Re: How to provide Log Off for a Web Application?
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=e4XdGVs6CHA.1776%40TK2MSFTNGP10.phx.gbl&rnum=30
Dim chandLogonCookie As HttpCookie chandLogonCookie = Request.Cookies("ChangeLogin") Try
If chandLogonCookie.Value <> "true" Then
chandLogonCookie = New HttpCookie("ChangeLogin", "true")
Response.Cookies.Add(chandLogonCookie)
Else
'//Ask IIS to authenticate the user if they are currently anonymous.
'//This may allow a second request to succeed.
Response.StatusCode = 401
Response.StatusDescription = "Unauthorized"
lblMessage.Text = "<h2>You are not authorized to view this page</h2>"
Response.Cookies("ChangeLogin").Value = "false"
End If
Catch
chandLogonCookie = New HttpCookie("ChangeLogin", "false")
Response.Cookies.Add(chandLogonCookie)
'//Ask IIS to authenticate the user if they are currently anonymous.
'//This may allow a second request to succeed.
Response.StatusCode = 401
Response.StatusDescription = "Unauthorized"
lblMessage.Text = "<h2>You are not authorized to view this page</h2>"
End Try GetName()
End Sub
Private Sub GetName()
txtName.Text = User.Identity.Name
End Sub
其實一次就已經變更登陸者了阿!http://expert.csdn.net/Expert/topic/1573/1573024.xml?temp=3.521365E-02
to saucer(思归, MS .NET MVP):
How to do it concretely ? tks.
HOWTO: Clear Logon Credentials to Force Reauthentication
http://support.microsoft.com/default.aspx?scid=KB;en-us;q195192