tags:

views:

49

answers:

4

Hi I have just redeveloped some vbscript in to c#.net and i have it working well.

However the function contained within the aspx.cs page that i have developed really needs to be used within a asp page.

Is there anyway that i can use my aspx.cs functions within an classic asp page.

Maybe using an include. If i can't it just makes the work that i have about 4 times larger or maybe i have to persuade someone to accept a different approach.

+1  A: 

ASP.NET and classic ASP are two completely different technologies. Classic ASP is an interpreted system while .NET is a compiled. So the only way to mix them is either using some interoperable format (such as SOAP) or maybe iframe inclusions. There's also another possibility: you could externalize this function into a class library of its own and expose it as a COM type using the regam.exe utility and consuming the resulting component from classic ASP:

regasm.exe /codebase assemblycontainingsharedcode.dll

Once registered you could simply CreateObject in vbscript to instantiate the .NET class. Also make sure that the managed assembly is decorated with the COMVisible attribute so that the types would be visible.

Darin Dimitrov
Thanks for the reply, I have never delt with asp classic, I have decided to go for the iframe solution, however once i have added the iframe with the correct src how do i get a value from the aspx page within the iframe.Possibly a very simple solution to this and sorry for being so simple!!
Truezplaya
A: 

One approach would be to take your functions from the aspx.cs page and compile them into a dll, register the dll for COM interop on the server and call into it from the ASP page.

Steve Danner
A: 

One option would be to use a javascript library such as Jquery to call out to the asp page and embed the results in the aspx page

Jon Simpson
it's the aspx page that contains the functionality to return a string vbalue that i want to display within the asp page
Truezplaya
A: 

You can't mix them on the same page, but you can use aspx and asp pages together on the same site.

Also you can output content from ASP.NET as Javascript, using an aspx page or ashx handler. You can link to the javascript in a script tag in your ASP page

<script language="javascript" type="text/javascript" src="http://mysite.com/dotnetApp/MapJavaScript.ashx" ></script>

In the handler file, you would document.write() the content you want to show on the ASP page.

Ed B