weixin_33725807 2010-02-27 19:30 采纳率: 0%
浏览 23

登出前显示弹出框

i have a doubt on how to show a popup???`

   if (machineID.Count != 0)
            { 
           checkMachineGrpState(machineID);
            }

            else
           {
                FormsAuthentication.SignOut();
                Session.Abandon();
                Response.Redirect("~/Default.aspx");
            }

Ok now what im am doing in else statement is signing out the user and sending him back to the log out page.... I need to how him some pop up message that he is being signed out i cant figure out how to do that... i tried messagebox but it wont work with servver and client side.. I want to use AJAX but dont know how... any suggestions.... thanks

  • 写回答

1条回答 默认 最新

  • weixin_33725239 2010-02-27 19:46
    关注

    There are a couple of different ways you can go about this. Here's a simple example.

    Your Default.aspx page will need to display the message to the user when they've logged out, so you might want a way to distinguish when you want to show the message. You could add a query string param to your redirect, like:

    Response.Redirect("~/Default.aspx?ShowLogout=true");
    

    Now on your Default.aspx page, you have a number of options. You could simply show a hidden control on the page, or write out some Javascript to show an alert box:

    if (!String.IsNullOrEmpty(Request.QueryString["ShowLogout"]))
                    ClientScript.RegisterStartupScript(this.GetType(), "LogoutMsg", "<script>alert('You have been logged out.');</script>");
    

    This will simply write out a script tag that runs when the user views the page. From here, you can make it more elegant by showing the user a better dialog box. For example, you could use jQuery to create a nice looking dialog box, and call the Javascript function to show it rather than calling alert in my example.

    评论

报告相同问题?

悬赏问题

  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决