locked
Visual studio 2017 - cannot locate formsauthentication class RRS feed

  • Question

  • Hello,

    I am writing an application in Visual Studio 2017 and would like to reference the FormsAuthentication class. On-line documentation tells me that the class is in the System.Web.Security namespace, in System.Web.dll. I added a reference to System.Web in project - there was no reference to System.Web.Security available. The System.Web.dll I am referencing appears to be for .NET framework 4.5.2.

    Just to be clear, I have added references to System.Web and System.Web.ApplicationServices to my project, as well as added the appropriate "using" statements.

    Any thoughts or ideas ? This is a real blocker for me.

    Thanks

    Rich Orpen


    • Edited by irondog1 Saturday, July 1, 2017 10:36 PM
    Saturday, July 1, 2017 7:31 PM

Answers

  • Hi irondog1,

    Of cause this is not only used to Windows Form project, if you want to make a dll, you can create a Class Library project as below:

    Right click on the solution and select the Class Library:

    Then add System.Web.dll to the References, and using System.Web.Security:

    Then build the solution so that you can add this library with a reference to another project through right click to add references.

    And the path is what you have created your classlibrary:

    Hope this helps!

    Best Regards,

    Stanly


    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.

    • Proposed as answer by Stanly Fan Thursday, July 6, 2017 4:02 AM
    • Marked as answer by irondog1 Thursday, July 6, 2017 3:05 PM
    Thursday, July 6, 2017 4:00 AM

All replies

  • Hi irondog1,

    >>I am writing an application in Visual Studio 2017 and would like to reference the FormsAuthentication class

    What application do you write? Is it Windows Form Application?

    If it is a Winform project, please refer to the following steps:

    Step1: Add System.Web.dll to the References:

    Step2: using System.Web.Security;

    Hope this helps!

    Best Regards,

    Stanly


    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.

    Tuesday, July 4, 2017 9:18 AM
  • Hi Stanly,

    Thanks for your response. I think I am seeing the problem. My VS 2017 project type is .NET Framework dll, because that is what I am trying to deliver - a dll that can be used for providing security. I am going to try creating a Windows Forms app using my current code purely as an exercise, but that will not get me where I want to be unless that code can be tucked into a dll somehow.

    Wednesday, July 5, 2017 11:59 AM
  • Hi irondog1,

    Of cause this is not only used to Windows Form project, if you want to make a dll, you can create a Class Library project as below:

    Right click on the solution and select the Class Library:

    Then add System.Web.dll to the References, and using System.Web.Security:

    Then build the solution so that you can add this library with a reference to another project through right click to add references.

    And the path is what you have created your classlibrary:

    Hope this helps!

    Best Regards,

    Stanly


    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.

    • Proposed as answer by Stanly Fan Thursday, July 6, 2017 4:02 AM
    • Marked as answer by irondog1 Thursday, July 6, 2017 3:05 PM
    Thursday, July 6, 2017 4:00 AM
  • Perfect Stanly - thanks so much for your help
    Thursday, July 6, 2017 3:05 PM