Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
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:
C#
//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;
       }

And in Login.xaml.cs, I called an event handler like this:
C#
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));
             }
         }


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
Posted
Updated 15-Feb-12 0:31am
v2
Comments
Manfred Rudolf Bihy 15-Feb-12 6:33am    
Next time please use proper capitalization and place pre tags around your code. Editing a post where every other word is improperly capitalized is PITA.

Thanks for your cooperation!

1 solution

if you override the custom provider classes you can use all the std FormsAuthentication methods etc and it will use your custom schema
 
Share this answer
 
Comments
vijay4mgvrm 17-Feb-12 1:57am    
Hi,
can you tell me detailed process for override the custom provider classes....

Thanks,
Vijay

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900