[英]Implement a login in SilverLight with WCF RIA
我使用SilverLight創建一個登錄頁面。 但是,當用戶登錄然后刷新頁面時,該用戶已注銷! 換句話說,SilverLight應用程序將重新啟動。 如何防止這種情況在刷新時發生?
我也遇到了同樣的問題,之后我發現了類似的問題。
我用登錄頁面和儀表盤頁面創建兩個頁面,這是我的登錄頁面代碼。 這將為您提供幫助。
private void BtnLogin_Click(object sender, RoutedEventArgs e)
{
user.Username = TxtUsername.Text;
user.Password = TxtPassword.Password;
YourReference.YourReferenceServiceClient Service = new YourReferenceServiceClient();
Service.LoginCompleted += Service_LoginCompleted;
Service.LoginAsync(user);
}
void Service_LoginCompleted(object sender, LoginCompletedEventArgs e)
{
if (e.Result == true)
{
Dashboard UserDashboard = new Dashboard(user);
this.Content = UserDashboard;
}
else
{
MessageBox.Show("Error Occured");
}
}
在WCF RIA服務中,我創建了一個名為Login的方法,這是該代碼。
public bool Login(User LogUser)
{
bool Status = false;
//......Your Code.... if it is success return True otherwise false//
return Status;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.