現在、RIAサービスでSilverlightを試しています。私は簡単なログインフォームを実装しています。また、次のファイルを生成する提供された認証ドメインサービステンプレートを使用しています。SilverlightとRIAサービス:セッション間のログインを維持する
[EnableClientAccess]
public class AuthenticationDomainService : AuthenticationBase<User>
{
// To enable Forms/Windows Authentication for the Web Application,
// edit the appropriate section of web.config file.
}
public class User : UserBase
{
// NOTE: Profile properties can be added here
// To enable profiles, edit the appropriate section of web.config file.
// public string MyProfileProperty { get; set; }
public int DefaultRows { get; set; }
}
私のアプリケーションでは問題なくログイン/ログアウトできます。 Silverlightアプリケーションでは、ログイン後、次の行が表示されます。
WebContext.Current.User.IsAuthenticated;
return true。
ただし、これをセッション間で維持する必要があります(つまり、F5を使用してページをリロードするとき)。
現在、ページがリロードされると、再ログインする必要があります。
WebContext.Current.Authentication.Login(new LoginParameters(this.UserName, this.Password, true, string.Empty),
(LoginOperation loginOperation) =>
{
if (loginOperation.LoginSuccess)
{
NotificationMessage Message = new NotificationMessage(this, null, "CLOSE");
Messenger.Default.Send<NotificationMessage>(Message);
}
}, null);
ログイン方法の第3のパラメータがIsPersistentパラメータです:
は、ここに私のログインコードです。 MSDNのドキュメントから、私はそれをtrueに設定すると、次回にページをロードするときに、ユーザーはまだログインしていると思います。しかし、これは当てはまりません。
内部で設定されているCookieを読んだ後、そのCookieによって提供されるユーザー名とパスワードでバックグラウンドでログインする必要がありますか?それとも、ここには他の魔法がありますか?
私はどうにかしてこれをやったことを願っています。 Silverlightのビジネスアプリケーションテンプレートを通過した後、事前