Infinite Loop when using cookieless session ID on azure

Source: Internet
Author: User

If you use cookieless session ID and deploy them on Azure, you might get infinite loop when you query your Web site, and browser wocould down. in this scenario, you need to overwrite ASP. net default isessionidmanager.

In method getsessionid, your cocould shoshould be below

 Public   String  Getsessionid (httpcontext context ){  VaR Id = httpcontext. Current. items [ "  Aspcookielesssession  " ]As   String  ;  //  Azure web site does not support Header "aspfiltersessionid", so we cannot get context. items ["aspcookielesssession"]  //  For azure web site use, headers ["X-original-URL"] format:/(S (XXX)/default. aspx      VaR Originalurl = httpcontext. Current. Request. headers [ "  X-original-URL  "  ];  If (!String  . Isnullorempty (originalurl )){  VaR Match = RegEx. Match (httpcontext. Current. Request. headers [ "  X-original-URL  " ], @"  /\ (S \ (\ W + )\)\)  "  );  If  (Match. Success) {ID = Match. Groups [ 1  ]. Value ;}} Return  ID ;} 

Don't forget to change your web. config file.

 

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.