FormsAuthentication log on to compatible with IE11 to save cookies. How can I view cookies in ie11?

Source: Internet
Author: User

FormsAuthentication log on to compatible with IE11 to save cookies. How can I view cookies in ie11?

Symptom: Using FormsAuthentication for login verification, the cookie cannot be saved on the IE11 Client

Solution: Add cookieless = "UseCookies" to forms in web. config.

Address: http://www.wlm.so/Article/Detail/lmb48dogzil3b00000

<authentication mode="Forms">  <forms cookieless="UseCookies" loginUrl="~/Login" domain="wlm.so"/></authentication>

  

 


MVC4 Forms authentication, deployed on Hyper-v FormsAuthenticationSetAuthCookie is invalid

I have also encountered this problem. This is a bug in IE10 or asp. A Bug in net4 that changes the http header in IE10, resulting in asp. net4 considers that the client does not enable the cookie, which may cause verification failure.
A simple solution is to add a browser definition file in the root directory of the website)
The procedure is as follows:
1. Add a "App_Browsers" folder
2. Add a file with the suffix "*. browser", such as IE10.browser.
3. Add the following file:
<Browsers>
<Browser refID = "Default">
<Capabilities> <! -- To avoid wrong detections of e.g. IE10 -->
<Capability name = "cookies" value = "true"/>
<Capability name = "ecmascriptversion" value = "3.0" type = "apiname" text = "apiname"/>
</Capabilities>
</Browser>
</Browsers>

How to store cookie values in winform

First, configure the related section // configure the identity ticket in config. After logging on, you can access it <! -- In the <authentication> section, you can configure the Security authentication mode used by ASP. NET to identify the passed-in user. --> // The session is saved on the local <sessionState mode = "InProc"> </sessionState> <authentication mode = "Forms"> // page that must be configured, cookie Name, default page, survival time (points) <forms loginUrl = "Login. aspx "name =" Hotel "defaultUrl =" Default. aspx "timeout =" 60 "> </forms> </authentication> // reject anonymous users. Otherwise, the Security authentication Mode does not work. <authorization> <deny users = "? "/> </Authorization> no matter which page he enters, he will log on to the page you configured, unless he has an identity ticket, the following is a FormsAuthentication statement after the user successfully logs in. setAuthCookie (UserName, true); // FormsAuthentication is a system class so that users can log on to the system. In this way, an unencrypted Cookie is automatically created, however, the security level is very low. If you want to learn more, you can refer to the following code for the handwritten encryption Cookie class: public class UserLoginManager: page {// <summary> /// Add the user identity to the Cookie, and encrypt /// </summary> /// <param name = "username"> </param> public void AuthenticationUsers (string username) {FormsAuthenticationTicket tichet = new FormsAuthenticationTicket (1, username, DateTime. now, DateTime. now. addHours (24), true, ""); string hashTicket = FormsAuthentication. encrypt (tichet); HttpCookie userCookie = new HttpCookie (FormsAuthentication. formsCookieName); userCookie. value = hashTicket; userCookie. expires = tichet. expiration; userCookie. domain = FormsAuthentication. cookieDomain; HttpContext. current. response. cookies. add (us ...... remaining full text>
 

Related Article

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.