如何在WP8中启用单点登录选项? [英] How to enable single sign on option in WP8?‏‏

查看:101
本文介绍了如何在WP8中启用单点登录选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用C#和xaml开发WP8应用程序,

在我的应用程序中,有一个登录页面,我有我的应用程序的自定义登录名

如果用户一次登录到应用程序,则不应再次要求用户登录.

Hi,



am developing a WP8 app using C# and xaml,

In my app there is an sign in page, I have my custom login for my app

If the user is signed into the app once then it should not ask user again for the sign in.

how to achieve that?

推荐答案

您可以将用户登录信息保存到IsolatedStorage.每个用户都有唯一的名称,我的意思是UserName中没有任何重复.因此,借助UserName,您可以将信息存储到IsolatedStorage.

例如

You can save the User Login information to IsolatedStorage. Each user has unique name, I mean there is no any duplication in UserName. So with the help of UserName you can store the information to IsolatedStorage.

For e.g.

public void SaveToStorage(string UserName)
{
    if (IsolatedStorageSettings.ApplicationSettings.Contains(UserName))
    {
        return;
    }
    IsolatedStorageSettings.ApplicationSettings["LoginStatus"] = UserName;
    IsolatedStorageSettings.ApplicationSettings.Save();
}

public bool GetFromStorage()
{
    if (IsolatedStorageSettings.ApplicationSettings.Contains(LoginStatus))
    {
        return true;                     // User is already Login
    }
    return false;
}



借助以上两个功能,您可以在Application Activated Launching event上检查此用户是否已经登录.



With the help of above two function you can check this on Application Activated or Launching event whether user is already login or not.


这篇关于如何在WP8中启用单点登录选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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