Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In an ASP.NET Web Setup Project, can I disable anonymous access in IIS?

I have a really simple ASP.NET web application and a web setup project that deploys the project output and content files to a virtual directory in IIS.

What I want is for the MSI to automatically disable Anonymouse Access for that virtual folder in IIS.

I suspect it can probably be done by writing some code in a custom action DLL, that would be acceptable, but is there any way to do it within the the settings of the web setup project?

like image 535
d4nt Avatar asked Jan 25 '23 00:01

d4nt


2 Answers

I'm sure you know that you could disallow users who are not authenticated via web.config

<system.web>
<authentication mode="Windows"/>
<authorization>
  <deny users="?"/> 
</authorization>
</system.web>

would do it I think.

like image 86
Ian G Avatar answered Feb 05 '23 18:02

Ian G


Taken from technet

The property for anonymous access is unfortunately not available through Web setup projects. For this reason, you must:

  1. Write a custom installer to enable or disable anonymous access.

  2. Pass the necessary parameters from the setup wizard to the installer at run time.

like image 37
redsquare Avatar answered Feb 05 '23 17:02

redsquare