Integrate classic ASP with ASP.NET - asp.net

I have a classic ASP site hosted on IIS and I need to add new pages to the site, but the new pages have to be ASP.NET; I created few pages put them in the same directory and they are working fine.
My problem is the classic ASP and ASP.NET pages are not sharing the sessions. The website on IIS is configured as InProc and use cookies, so my goal is if ASP.NET page defined session as
session("abc")=5
The classic ASP page that is on the same website and directory could read its value. Thanks in advance.

You can give a read to this :
http://msdn.microsoft.com/en-us/library/aa479313.aspx

On a whim as I have seen this before, but what do you see in the Applications Pools of the IIS Settings for your application? Is it set to .NET CLR Version # or something like that? Because that is what you want for .NET .. but if you want Classic ASP sessions, you need to set that to "NO MANAGED CODE" instead and the Managed Pipeline Mode needs to be set to Classic. Now I don't know how well these work back and forth from NET to CLassic .. but I know if you don't set it to Classic mode your sessions just go poof on you for no reason .. sometimes hold for an hour, sometimes gone on the next click 1 minute later. But long story short, if you have any classic asp .. you need it to be set this way or otherwise your sessions seem to just not work properly because it handles them with .NET techniques otherwise.

Related

Is it possible to use same authentication on classic asp and asp.net 4.5 on IIS7

I am trying to apply single sign-on to legacy classic asp applications and asp.net applications. I have created a asp.net login page for all aplications. I can successfully pass the authentication ticket from new login page to the old asp.net application and share the session using sql server. However, I cannot do the same thing for class asp applications. Even though I have logged in to the new asp login page, it still redirects me to the new login page when I go to the classic asp applications. I have already checked that their machine keys are the same. The classic asp applications are some .asp pages and html files without web.config before. I added the web.config file to the folder by myself. I can see the machine key in the IIS manger so I think it is reading the file.
Classic ASP and ASP.Net use a different session state object, therefor you're not logged in into your classic ASP site.
There is a possibility, it's kind of a hack. I used it once and it works pretty well. Please have a look at this blogpost to see if it fulfills your needs. It uses the ASP session cookies from .Net in asp classic to call a .Net page that returns session (login) data:
http://devproconnections.com/aspnet/share-session-state-between-asp-and-aspnet-apps

Mixing ASP.NET pages with ASP Pages in windows server 2003 IIS

I've got a lot of Classic ASP pages in production on a Windows Server 2003 64-bit machine. I've also got .NET on there working.
I'm starting to move the ASP ajax pages (pages that receive ajax calls from the Classic ASP) to ASP.NET/C# to take advantage of the business/data/logging layer I've got set up there in C#.
I've figured on securing the ASPX pages by way of a "token" that I create in the database in ASP and then pass to the ASPX page, which then uses it to validate that it's a legit call and destroys it.
My big question is - aside from making the ASPX pages, do I need to compile the app into the same site as the ASP site? I assumed I'd do that - deploy it there alongside the ASP Classic pages, and then just call the ASPX individually as needed.
Is this strategy sound? Do I need to do anything special for performance or configuration to make ASP Classic and ASP.NET coexist well?
Thanks - this migration has been a bear because of the extreme asp classic dependency.
It will work just fine. I've seen it on several sites. Just put them all in the same directory.
Your biggest issue will be that the ASP and ASP.NET pages will each have their own SESSION and APPLICATION variables which won't be shared between the two. If you are using session variables in either it can force you into doing a lot of hacks to make it all work together well.

Session transfer between asp.net and asp works in soome cases and in some cases not

I transfer session from asp.net to classic asp.
I use MSSQL DB for it.
I have
SomeWebPage.aspx - this page is asp.net which save sesion, after it, it call by redirect
SessionTransfer.aspx -this page save sessions to DB and call by redirect
SessionTransfer.asp - this page load session from DB and cal by redirect
SomeWebPage.asp - this page doesn't need now about other pages, it just use session.
Problem is, that it works only if SomeWebPage.aspx, SessionTransfer.aspx, SessionTransfer.asp and SomeWebPage.asp are in same folder, or in same "web pages" folder on iis.
How can i do it if SomeWebPage.asp will be in other web folder. On same IIS server, but it will be specific web?
I use IIS 5.1 for developing and finished program will run on IIS 6.0.
Problem was that it was different applications.
SessionTransfer.asp must be it same application like SomeWebPage.asp (it wasn't)
and
SessionTransfer.aspx must be it same application (pool) like SomeWebPage.aspx (it was)
It ws teddy-bear problem. When we start discus about this, i realized where is problem :-D
thanks amit_g

Get authenticated user from ASP.NET in ASP classic

I have a lot of ASP.NET 2.0 applications using the form authentication. It works well but now I need to integrate this in one of our old ASP classic application. I've checked this Scott Gu blog entry (http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx) and I follow the instruction but it doesn't work for me. When I check the AUTH_USER server variable in my asp.net page, it contains the same user name as User.Identity.Name but the same server variable is empty when I return to my ASP classic page. All pages are in the same virtual directory on IIS 6.0.
Thanks for your help.
I've figured out what was missing (the wildcard configuration). With that set properly, it works.

Why can I not get application object in classic ASP when I add a .NET Wildcard mapping to directory?

We're migrating a site from classic asp to .NET. In the process, I need to use .NET authentication to secure the classic asp pages. This works great with wildcard mapping...unless the classic asp pages try to use something like the Application object.
I have tried adding an HTTPHandler to pass the request to the asp.dll, but to no avail.
Is what I am trying to do even possible?
Are you trying to have some of your old 'classic' asp pages within the same site as the .aspx pages? We've done something similar here, but we wound up with two websites, one for the asp and one for the .net and did some session sharing to perform the authentication.
It is possible on IIS7 using the integrated pipeline, I would say it would be highly fragile on IIS6 with wildcard mapping.

Resources