奇幻城娱乐app_奇幻城娱乐手机版
做最好的网站
来自 奇幻城科技资讯 2019-07-31 18:50 的文章
当前位置: 奇幻城娱乐app > 奇幻城科技资讯 > 正文

旅行不费力奇幻城娱乐app,ID用户登录网站

[原文连接/翻译:Judy][[奇幻城娱乐app,整理编译自 Sphere Trading]不想再在机场里拖着行李箱吗?让LiveLuggage 动力行李箱(Power Assisted Suitcase)帮帮你吧!这款行李箱内置可充电式电池,出发前充一次电,即可使用约两个小时或将近两英里,虽然行李箱有一点重(24磅,约10公斤),不过抗重力把手能帮你把85%的重量分散到轮子上,其它配备还包括经美国安全运输局核可的组合锁和Live Locator™ ID,万一行李箱遗失了,可以靠Live Locator™ ID定位,找寻行李的下落,另外还设计了专门放伞的地方,要价美金1,365.25元,约人民币9,360元。


当Windows Live ID验证通过,Widnows Live将返回到我们的登录页面,下面这个页面现在将显示欢迎您的信息和您的用户ID :

那么我们绑定了 Windows Live ID 的账号有什么好处呢?当我们忘记 Windows Live ID 的密码, 或者 Windows Live ID 被盗用篡改密码后,我们可能无法再用 Windows Live ID 登陆Windows 8。此时,我们不再需要通过"安全提示问题"、备用邮件或联系客服这些传统而麻烦的方式来重置密码。我们只需登陆域帐户,由于该电脑是被信任的,重置密码可以轻松完成。

Using REST with the Windows Live Contacts API

Default.aspx页面中的HTML的代码如下:

众所周知,Windows 8 系统可以用 Windows Live ID 登陆。那么我们在公司,一般都使用域帐户,如何才能够同步我们的 Windows Live ID 账户呢?其实,Windows 8 有一项新功能,它能够将 Windows Live ID 和域帐户绑定,在登陆域帐户的同时,同步 Windows Live ID 的信息内容。需要注意的是,为了提高安全性,Windows Live ID 的密码并不会立刻被同步,我们需要手动进入电脑设置 -> 同步你的设置 -> 信任这台计算机 -> 之后登陆 Windows Live 网站,管理你的账户安全信息,确认你的计算机在信任列表中。

The Windows Live Contacts Web service is exposed to clients in a HTTP/GET request interface with XML response.

using System;
using System.Web;
using System.IO;
using WindowsLive;
/// <summary>
/// This is the default aspx.cs page for the sample Web Auth site.
/// It gets the application ID and user ID for display on the main
/// page.  
/// </summary>
public partial class DefaultPage : System.Web.UI.Page
{
const string LoginCookie = "webauthtoken";
// Initialize the WindowsLiveLogin module.
static WindowsLiveLogin wll = new WindowsLiveLogin(true);
protected static string AppId = wll.AppId;
protected string UserId;
protected void Page_Load(object sender, EventArgs e)
{
/* If the user token has been cached in a site cookie, attempt
           to process it and extract the user ID. */
HttpRequest req = HttpContext.Current.Request;
HttpCookie loginCookie = req.Cookies[LoginCookie];
if(loginCookie != null){
string token = loginCookie.Value;
if (!string.IsNullOrEmpty(token))
{
WindowsLiveLogin.User user = wll.ProcessToken(token);
if (user != null)
{
UserId = user.Id;
}
}
}
}
}

 Windows 8离我们越来越近了,正式版也在进行倒计时了,对于企业管理人员来讲,又是一波新的战争了,什么战争呢,那就是Windows 8引入了新的身份认证方法,可以通过Windows Live ID登陆系统,这样我们曾经的Active Directory用户情何以堪,有问题就一定有解决的方法,微软总不会搬起石头砸自己的脚。

To use the Windows Live Contacts API, an application must use the Representational State Transfer (REST) protocol to send requests to Windows Live Contacts and receive responses in reply.

完毕!

The HTTP methods that the Windows Live Contacts REST implementation supports are based on the definitions in RFC 2616.

奇幻城娱乐app 1


奇幻城娱乐app 2

This API is intended for customers and partners who want to take advantage of the Address Book service known as Windows Live Contacts. An example of an application that may be built on this API is described in About the Windows Live Contacts API.

Default.aspx将作为网站的一个登录页。 用户点击登录按钮,将被重定向到的Windows Live 登录页面。 当他微软进行身份验证后,微软会重新回到我们的处理程序页上,所以,我们现在将创建一个新的aspx页,并将其命名webauth-handler.aspx。 还记得,当我们在注册申请Windows Live 时提供的返回URL的网页吗。

Method Usage

GET

Retrieves whatever information is identified by the request Universal Resource Identifier (URI). When a GET request succeeds, the response contains the data that is requested. For more information, see Windows Live Contacts API Methods: GET.

POST

Inserts the data that is enclosed in the request body as a child of the element or elements identified by the request URI. When a POST request succeeds, the response code is the "201 Created" status code, and the response contains a Location header that points to the newly-created object or objects. For more information, seeWindows Live Contacts API Methods: POST.

When a caller uses the POST method, the caller inserts data under the parent that the request URI identifies.

Multiple child objects can be created by using a single POST request.

PUT

Updates the object that is identified by the request URI with the data that is supplied in the request body. When a PUT request succeeds, the response code is the "204 No Content" status code, and no content is returned. For more information, see Windows Live Contacts API Methods: PUT.

DELETE

Removes the data object that is identified by the request URI. When a DELETE request succeeds, the response code is the "204 No Content" status code, and no content is returned. For more information, see Windows Live Contacts API Methods: DELETE.

The request URI identifies the object or the class to be manipulated by the method. Additionally, the request URI effectively describes the path through the data hierarchy to the object or objects. An example request URI might be:

/LiveContacts/Contacts/Contact(ContactID)/Locations/Location(LocationID)/CompanyName

This request URI identifies a specific Contact container by ID (ContactID) and, within that contact, a specific location class by ID (LocationID), which could refer to any Location container. Then, the request URI identifies the actual property. In this example the actual property is the CompanyName element.

With this URI format and a chosen method, you can identify and act on any piece of data in Windows Live Contacts by using a single HTTP call.

现在有很多在线服务的验证,我曾经就写过一篇 如何在ASP.NET中创建OpenID, 这里我再介绍如何使用Windows Live ID在ASP.NET应用程序中验证用户的身份,说穿了这也是一种特殊验证模型,也就是说当在您的网站中使用Windows Live ID登录时,此用户首先会重定向到Windows Live登录页,然后通过验证的用户Windows Live将该用户再重定向到您的网站,并提供一个用户ID。

The Windows Live Contacts API defines a set of Web services that enables customers to programmatically access the Windows Live Contacts Address Book database.

呵呵,老样子,微软已经为ASP.NET开发者已经提供了非常容易实现的示例模板。这里下载:, 准确点可以看该文:。默认安装路径在:C:Program FilesWindows Live IDWebAuth。

REST is an HTTP-based protocol for remote data operations, for example from a client application to a Web service. With REST, the object and the verb are separated because a fixed set of verbs exist. You supply the path of the object within the schema on which you want the action to take place.

奇幻城娱乐app 3

 

 

奇幻城娱乐app 4

点Sign In链接后,将重定向到Windows Live的登录页面:

当以上操作都完成后,现在应该可以使用Windows Live ID登录了,我们首页浏览登录页面Default.Aspx:

奇幻城娱乐app 5

前言

 

整合到您的网站

 

 

奇幻城娱乐app 6

webauth-handler.aspx页面将作为处理Windows Live重定向回到您的网站用户的网页。 而且微软Windows Live将提供一个验证特定值给您使用。 我们可以简单地删除所有的标记,下面是webauth-handler.aspx代码隐藏类的代码:

   1: using System;

   2: using System.Web;

   3: using System.IO;

   4: using WindowsLive;

   5:  

   6: /// <summary>

   7: /// This page handles the login, logout and clearcookie Web Auth

   8: /// actions.  When you create a Windows Live application, you must

   9: /// specify the URL of this handler page.

  10: /// </summary>

  11: public partial class HandlerPage : System.Web.UI.Page

  12: {

  13:     const string LoginPage = "default.aspx";

  14:     const string LogoutPage = LoginPage;

  15:     const string LoginCookie = "webauthtoken";

  16:     static DateTime ExpireCookie = DateTime.Now.AddYears(-10);

  17:     static DateTime PersistCookie = DateTime.Now.AddYears(10);

  18:  

  19:     // Initialize the WindowsLiveLogin module.

  20:     static WindowsLiveLogin wll = new WindowsLiveLogin(true);

  21:  

  22:     protected void Page_Load(object sender, EventArgs e)

  23:     {

  24:         HttpRequest req = HttpContext.Current.Request;

  25:         HttpResponse res = HttpContext.Current.Response;

  26:  

  27:         // Extract the 'action' parameter from the request, if any.

  28:         string action = req["action"];

  29:  

  30:         /*

  31:           If action is 'logout', clear the login cookie and redirect

  32:           to the logout page.

  33: 

  34:           If action is 'clearcookie', clear the login cookie and

  35:           return a GIF as response to signify success.

  36: 

  37:           By default, try to process a login. If login was

  38:           successful, cache the user token in a cookie and redirect

  39:           to the site's main page.  If login failed, clear the cookie

  40:           and redirect to the main page.

  41:         */

  42:  

  43:         if (action == "logout")

  44:         {

  45:             HttpCookie loginCookie = new HttpCookie(LoginCookie);

  46:             loginCookie.Expires = ExpireCookie;

  47:             res.Cookies.Add(loginCookie);

  48:             res.Redirect(LogoutPage);

  49:             res.End();

  50:         } 

  51:         else if (action == "clearcookie")

  52:         {

  53:             HttpCookie loginCookie = new HttpCookie(LoginCookie);

  54:             loginCookie.Expires = ExpireCookie;

  55:             res.Cookies.Add(loginCookie);

  56:  

  57:             string type;

  58:             byte[] content;

  59:             wll.GetClearCookieResponse(out type, out content);

  60:             res.ContentType = type;

  61:             res.OutputStream.Write(content, 0, content.Length);

  62:  

  63:             res.End();

  64:         } 

  65:         else 

  66:         {

  67:             WindowsLiveLogin.User user = wll.ProcessLogin(req.Form);

  68:  

  69:             HttpCookie loginCookie = new HttpCookie(LoginCookie);

  70:             if (user != null)

  71:             {

  72:                 loginCookie.Value = user.Token;

  73:  

  74:                 if (user.UsePersistentCookie)

  75:                 {

  76:                     loginCookie.Expires = PersistCookie;

  77:                 }

  78:             } 

  79:             else 

  80:             {

  81:                 loginCookie.Expires = ExpireCookie;

  82:             }   

  83:  

  84:             res.Cookies.Add(loginCookie);

  85:             res.Redirect(LoginPage);

  86:             res.End();

  87:         }

  88:     }

  89: }

 

使用Windows Live ID

 

 

 

第一次登录测试

 

下载并安装Windows Live ID Web身份验证的SDK

Default.aspx文件的代码隐藏文件代码如下:

要开始使用的Windows Live ID ,首先你需要申请一个应用程序ID。转到: 注册应用程序ID,其实微软针对此应用还有一个指南--->

奇幻城娱乐app 7

然后在web.config文件中配置刚申请一个应用程序ID 000000004400D659,

首先用Visual Studio2008或者2005创建一个Asp.Net网站,然后将安装的示例模板中的App_Code文件夹中的WindowsLiveLogin.cs(C:Program FilesWindows Live IDWebAuthSampleApp_CodeWindowsLiveLogin.cs)添加到我们的App_Code文件夹中。这里我直接用微软的示例,不自己新建网站了。

上面这个注册表格要填的我都填了,其中要注意的是 返回的URL,这个页面主要是处理与 Windows Live ID的沟通,如我现在VS的启动页是:

<body>
<table width="320">
<tr>
<td>
<h1>
欢迎来到Windows Live ID&trade;网络身份验证SDK中的C#模板</h1>
<p>
下面的链接表明您是否登录。如果该链接的文本是 <b>Sign in</b>, 表明您尚未登录。如果它显示 <b>Sign out</b>,表明您已经登录。</p>
<iframe id="WebAuthControl" name="WebAuthControl"
src="http://login.live.com/controls/WebAuth.htm?appid=<%=AppId%>&style=font-size: 10pt; font-family: verdana; background: white;"
width="80px" height="20px" marginwidth="0" marginheight="0" align="middle" frameborder="0"
scrolling="no"></iframe>
<p>
<% if ( UserId == null ) { %>
你还没有登录到网站,请点击 <b>Sign in</b> 链接.
<% }
else { %>
您已经登录到网站,您的用户编号ID = "<b><%=UserId%></b>".
<% } %>
</p>
</td>
</tr>
</table>
</body>
</html>

本文由奇幻城娱乐app发布于奇幻城科技资讯,转载请注明出处:旅行不费力奇幻城娱乐app,ID用户登录网站

关键词: 奇幻城娱乐app