locked
Visual Studio 2015 project authentication is wrong when using custom template RRS feed

  • Question

  • I have created a custom ASP.NET MVC template in Visual Studio 2015 Pro that is supposed to use Windows authentication by default. I am using IIS Express. I have noticed an odd behavior in that when a new project is created from this template, the project Properties Window shows that Windows Authentication is disabled and I get an "Access Denied" error if I try to run it. The original project has the proper option set in the Properties Window and the web.config file in the template does contain the proper authentication tag (shown below). If I go in and try to edit the project file in a text editor, there is no mention anywhere that Windows authentication is disabled. I have verified that this also happens in a base MVC project with nothing changed other than the Windows authentication setting and that it is happening on all of our computers that have VS.

    Once the template is used, rebuilding the project does nothing. I can change the mode immediately to make it work, but even more strange is that if I close and reopen the project the setting will change to "Enabled" and it works fine. Neither of these solutions are acceptable as it may lead other developers on a wild goose chase that has a simple solution. Is there something that I need to change in the template itself for Visual Studio to recognize this or is this a bug? I've yet to find any other accounts of this.

    <authentication mode="Windows" />
    <authorization>
      <allow roles="MY_DOMAIN\Domain Users" />
      <deny users="?" />
    </authorization>




    • Edited by bigempin Friday, December 1, 2017 4:14 PM
    • Moved by 宝宝徐 Monday, December 11, 2017 9:51 AM
    Friday, December 1, 2017 4:10 PM

All replies

  •  
    <allow roles="MY_DOMAIN\Domain Users" />

    Based on above code, I assume you are using roles other than users

    https://msdn.microsoft.com/en-us/library/acsd09b0%28v=vs.71%29.aspx?f=255&MSPPError=-2147217396

    so please specify it with Role's name like Admin or Administrator.

    Btw, this forum is for Visual Studio IDE issues, as yours is more related to ASP.NET developing, which has its own support forum:

    https://forums.asp.net/

    You might post your issue there to get more professional advice.

    Your understanding and cooperation will be grateful.

      

    Regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Monday, December 4, 2017 6:12 AM
    • Proposed as answer by Fletch Zhou Tuesday, December 5, 2017 9:46 AM
    Monday, December 4, 2017 6:12 AM