Add ADFS verification support for Azure Web Site 2 Use ADFS, azureadfs in code

Source: Internet
Author: User

Add ADFS verification support for Azure Web Site 2 Use ADFS, azureadfs in code

Next we will create an ASP. Net Program for MVC 5.0 and deploy it on the Azure Web Site.

Use Visual Studio 2015 to create a Web Project and change the authentication method at the place where the ASP.net template is selected.

Public void ConfigureAuth (IAppBuilder app) {app. setdefadefasigninasauthenticationtype (CookieAuthenticationDefaults. authenticationType); app. useCookieAuthentication (new CookieAuthenticationOptions (); app. useWsFederationAuthentication (new WsFederationAuthenticationOptions {Wtrealm = realm, MetadataAddress = adfsMetadata, BackchannelCertificateValidator = null ,});}

Open Global. asax. cs and add the following code:

Protected void Application_Start () {AreaRegistration. registerAllAreas (); FilterConfig. registerGlobalFilters (GlobalFilters. filters); RouteConfig. registerRoutes (RouteTable. routes); BundleConfig. registerBundles (BundleTable. bundles); ServicePointManager. serverCertificateValidationCallback = delegate {return true ;};}

After the code is added, you can publish the Web Project to the Azure Web Site.

In this case, we use a browser to open the published Web Site address, which will automatically jump to the ADFS logon interface.

Here we can use the AD account in the enterprise to log on to our Web Site.

 

 

Here are more detailed Blog posts from foreigners. For more information about good English, refer:

Http://www.tuicool.com/articles/NrMZ7v2

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.