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:
[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:
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