Friday, February 17, 2012

Integrating Classic ASP with ASP.Net Forms Authentication

If you are still running applications that require Classic ASP, you may want to run them side-by-side your ASP.Net applications while you are in the process of upgrading or converting them completely over to ASP.Net.

You can do that quite easily with ASP.Net Forms Authentication and Integrated Mode now available in IIS 7/IIS 7.5

You can learn more about how to accomplish this here: http://learn.iis.net/page.aspx/244/how-to-take-advantage-of-the-iis-integrated-pipeline/

If you want to get starting with your own Classic ASP application using ASP.Net Forms Authentication, there is a convenient Visual Studio Project Template I created available here: http://visualstudiogallery.msdn.microsoft.com/a82bc146-2d1a-459e-94cf-370d33fd772c?SRC=Home

5 comments:

  1. How do we pass the autentication token/ticket to the Classic ASP pages?

    I have to support a classic ASP application written about 12 years ago which was on IIS 6.0 but was moved to IIS 7.5 recently. They want to replace the basic authentication with Forms based authentication validating against Active Directory directly.

    When I use the Integrated mode as specified, I just get redirected back to my login page even after the user is authenticated successfully. I am assuming that is because the authentication ticket is not available to my ASP pages?

    Please do let me know..I am not sure if this is even possible at this point. We do not have the time to rewrite the application

    ReplyDelete
  2. I would highly recommend this book which outlines and provides some details on how to integrate both an ASP and ASP.NET Application and pass around authentication tokens (in IIS 7/7.5):
    Professional ASP.NET 3.5 Security, Membership and Role Management in C# and VB: http://www.amazon.com/Professional-ASP-NET-Security-Membership-Management/dp/0470379308/ref=sr_1_4?ie=UTF8&qid=1362175996&sr=8-4&keywords=professional+asp.net+membership

    ReplyDelete
  3. Hi There,

    Thanks for responding. I did order the book. Have not received it yet. To take a step back though, is it possible to implement Forms authentication in classic ASP alone? I am on a limited timeline here and some folks online seem to be suggesting it is not possible to integrate the two and pass information between the two..

    Thanks,
    Krishna.

    ReplyDelete
  4. You have to use ASP.NET pages to handle the FormsAuthentication logic otherwise it is not considered FormsAuthentication. In addition, in IIS 7.0 and above, you must add the following section to your Web.config:








    (Ch. 7, pg. 395)

    To pass data to ASP from ASP.Net, you can write a custom Http Handler and pass data around using the Request Headers so that the information will show up in the ASP Request.ServerVariables collectino (Ch 7, pg. 392)

    ReplyDelete
    Replies
    1. Here is the link to the book on the Wrox Press site:
      http://www.wrox.com/WileyCDA/WroxTitle/Professional-ASP-NET-3-5-Security-Membership-and-Role-Management-with-C-and-VB.productCd-0470379308,descCd-DOWNLOAD.html

      Delete