When ASP. NET Forms authentication method encounters Apple IOS

Source: Internet
Author: User

When ASP. NET Forms authentication method encounters Apple IOS
I. The problem occurs when I use ASP. NET MVC4 for development, I use Forms as authentication. Generally, they are added in web. config: <authentication mode = "Forms"> <forms loginUrl = "~ /Account/Login "name =" webcookies "slidingExpiration =" true "timeout =" 30 "/> </authentication> then, after the user successfully logs on, set Cookies. The Code is as follows: copy the public static void SetTicket (HttpResponseBase response, bool remeberMe, int version, string identity, string displayName) {FormsAuthentication. setAuthCookie (identity, remeberMe); string userData = displayName; var authTicket = new FormsAuthenticationTicket (version, identity, D AteTime. Now, DateTime. Now. AddDays (remeberMe? 30: 1), remeberMe, userData); string encrytedTicket = FormsAuthentication. encrypt (authTicket); HttpCookie authCookie = new HttpCookie (FormsAuthentication. formsCookieName, encrytedTicket); response. cookies. add (authCookie);} copy the code. I use FormsAuthenticationTicket here. version stores the User Role ID. At the beginning, I was proud of my wit and exquisite design, and I had no problem running on Android phones. However, on IOS, No matter what value I set for Version, its value is always 2. According to msdn: If FormsAuthenticationTicket is created using a constructor that does not provide the version parameter, the Version attribute returns 2; otherwise, the Version attribute returns the value provided to the FormsAuthenticationTicket constructor. I have already created a constructor that provides the version parameter, but it cannot be used on IOS. I have not obtained a good explanation for a lot of materials. I hope that the blogs can help me explain this problem. Later I saw the bottom of Microsoft's page: supported platforms: Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, windows Vista SP2, Windows Server 2008 (core roles of servers are not supported), and Windows Server 2008 R2 (core roles of servers with SP1 or higher are supported; Itanium is not supported. No matter what, the problem that has plagued me for a long time has finally found the problem. I would like to warn the latecomer here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.