注销后如何提供安全性 [英] How to Provide security After LogOut

查看:97
本文介绍了注销后如何提供安全性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个包含Login.xaml和UserDetails.xaml的Silverlight应用程序.

现在,我创建了一个WCF服务,用于执行登录检查,如下所示:

I developed a Silverlight application that contains Login.xaml and UserDetails.xaml.

Now I created a WCF service for doing a login check like this:

//service for Login
       [OperationContract]
       public ClsFirstGuardion Login(string UserName, string Password)
       {ClsFirstGuardion list = new ClsFirstGuardion();
           DBDataContext db = new DBDataContext();
           var v = from i in db.fg0au000s
                   where i.Username == UserName && i.Password == Password
                   select new { i.Username };
           foreach (var i in v)
           {       if (i == null)
               {
                   list.PMessage = "invalid";
               }
               else if (i != null)
               {
                   list.PMessage = i.Username;
               }
           }
           return list;
       }


在Login.xaml.cs中,我这样调用了事件处理程序:


And in Login.xaml.cs, I called an event handler like this:

ServiceReference1.WcfServiceClient client = new ServiceReference1.WcfServiceClient("CustomBinding_WcfService", servAddr);
                 client.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(client_LoginCompleted);
                 client.LoginAsync(textBox1.Text, passwordBox1.Password); 

void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
         {
             ClsFirstGuardion cs = e.Result;
             if (cs.PMessage == null)
             {
                 txtbloxLoginMessage.Text = "The UserName or Password you Entered is InCorrect";
             }
             else
             { string StudentId = cs.PMessage;
                  this.NavigationService.Navigate(new Uri(String.Format("UserDetails.Xaml?id=", StudentId), UriKind.Relative));
             }
         }



现在,我在UserDetails.xaml页面中访问查询字符串值,并显示了该名称.

现在我的要求是如何从此页面提供注销功能?
单击注销后,我不应访问此页面(UserDetails.Xaml).
在注销事件中,我编写了代码以导航至Login.xaml页面.

我的问题是单击注销按钮后单击浏览器的后退按钮.
然后显示UserDetails.xaml页面.我需要针对此要求的解决方案.

有人可以给我一个符合我要求的程序吗?

谢谢,
Vijay



Now I access the query string value In UserDetails.xaml page and I displayed that name.

Now my requirement is how to provide a logout functionality from this page?
I should not access this page(UserDetails.Xaml) after clicking logout.
In the logout event I wrote code to just navigate to Login.xaml page.

My problem is when I am clicking the browser''s back button after clicking the logout button.
As it is then displaying UserDetails.xaml page. I need a solution for this requirement.

Can anyone please give me a procedure for my requirement?

Thanks,
Vijay

推荐答案

如果您覆盖自定义提供程序类,则可以使用所有std FormsAuthentication方法等,它将使用您的自定义架构
if you override the custom provider classes you can use all the std FormsAuthentication methods etc and it will use your custom schema


这篇关于注销后如何提供安全性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆