elberon5.com

ASP.NET Classic ASP Integration - The painless, lazy way.

Posted by elberon5 Fri, 30 Mar 2007 15:37:00 GMT

I'll be editing this article soon, but just to get you started here's some posts that will point you in the right direction and a synopsis of the approach I took.

We're dealing with the new Asp.Net 2.0 Membership and integrating that with some good old classic asp.

  • Scott Gu's Blog Post - This will point you at the wrox security book, which I highly recommend. This post shows you how to make asp.net intercept all requests to your server. It doesn't work on XP and IIS 5.1. Also be sure that your IIS 6 isn't running in 5.1 isolation mode.
  • dotnetwookie's post - Here's a nice lazy workaround for importing legacy users. Using this you can hold off on importing users until you're good and ready.


    The trick to it is that you don't do a full integration. You just set your session variable for .net and classic and let them go about their business until you are ready to eventually kill all the classic pages. You are going to run into problems with the two timing out at different times. I haven't tackled that problem yet.

    Here's how you do it. I'm assuming you've got a login page that classic already uses and sets a ton of session variables, but you can't figure out how to make that run from asp.net. What you do is overload your Asp.Net login page so that it redirects the user to a new classic asp page when it authenticates them. This asp page sets the values you originally set in your old login page then pushes the users onto the page they originally requested. There's one trick to this. The users authentication ticket doesn't get set until they hit an aspx page. So put a page in-between the login and the classic session variable setting page to drop the ticket onto the client.

    I'll post some code for this soon, if anyone is actually interested. The method you want is OnLoggedIn in your asp:login and you'll want to pass along the ReturnUrl from the in-between page to the classic asp so it will know where to go.

    Good Luck. I'll post soon on how to deal with your virtual directories and why they don't share the membership with the root. And include some more code.

    Ignore this part, These are just some of the keywords i used to search for this that will hopefully get it ranked higher so that devs can find this. Keywords: HttpRequest, HttpResponse, Login, Authentication, Membership, Asp.Net, Server Side Ajax, HttpWebResponse, HttpWebRequest, Server.Execute, virtual directories, Session, State, Passing, Sharing, Peanuts. ASP.Net Classic Asp User Integration

  • (leave url/email »)