How to protect password with static site in Azure

I have a static site (i.e. all html files, no .Net project), which is hosted in Azure. I am trying to password protect this site. I read that I can create my own authorization module, which I did, but I can’t install it, because I need to run the appcmd.exe command to allow editing the correct web.config bit.

Or; how can I password protect a static azure site or how can I use the functions of ServiceDefinition.csdef without a visual studio project?

+6
source share
2 answers

On the management portal, you can configure your site to use credentials. Credentials are managed through the Azure portal if you use this method. enter image description here

+3
source

You can use Forms Authentication , which should be fairly simple to implement and will not require a task to run (you need to run appcmd.exe),

Configure the application to use authentication in your web.config.

<authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="/myadminlogin.aspx" protection="All" path="/" timeout="120" /> </authentication> 

Define protected folders in the web.config file.

  <location path="secure"> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> 

In your login area, check the status and set the auth cookie:

  'SET AUTH COOKIE FormsAuthentication.SetAuthCookie(sessionID, False) response.redirect(/secure/securearea.html) 

This, unfortunately, is one page where you will need server-side code.

0
source

All Articles