have you tried
Response.StatusCode =401
?then check Page.User.Identity.Name

解决方案 »

  1.   

    wating , same question as me!
      

  2.   

    Let me try it again.
      

  3.   

    to saucer(思归, MS .NET MVP):
    倒是能够出现登陆窗口,可是登陆不了,总是重复出现啊。咋办?
      

  4.   

    参考
    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
      

  5.   

    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
      

  6.   

    使用Response.StatusCode = 401的時候為甚麼要跳出三次登陸提示框?
    其實一次就已經變更登陸者了阿!http://expert.csdn.net/Expert/topic/1573/1573024.xml?temp=3.521365E-02
      

  7.   

    yes, it is weird, there must be some settings
      

  8.   

    这句Response.StatusCode = 401是干什么用的?
      

  9.   

    to ynacc(ynacc),呵呵,是用來解決我的問題的.
    to  saucer(思归, MS .NET MVP):
      How to do it concretely ? tks.
      

  10.   

    sorry, I haven't figured it out yet
      

  11.   

    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
      

  12.   

    Thank you for your help.