PDA

Click to See Complete Forum and Search --> : compile aspx into dll


mandreko
May 26th, 2002, 01:07 AM
i was reading in one of my books that you can compile your code-behind, so that you can code your html/asp but still have the code in a dll which is executed.

Does anyone know how to make that dll, and how to reference it in the aspx file ?

gijsj
May 26th, 2002, 02:52 PM
ASP.NET always compiles your code into a .dll (assembly). You can find the assembly in C:\WINDOWS\Microsoft.NET\Framework\v1.0.3423\Temporary ASP.NET Files

Code Behind has nothing to do with this, it's only a seperation of UI stuff (html, client side script etc.) and server side code (vb.net, c# etc.)

weijian
May 26th, 2002, 03:02 PM
Actually, it does. Try this article in 4guysfromrolla (http://www.4guysfromrolla.com/webtech/100500-1.shtml) . :)

gijsj
May 26th, 2002, 03:11 PM
That's not true, that article is wrong !
If you don't use code behind there is still a assembly generated.
Just create an .aspx page without code behind, run it, and check for the following directory: C:\WINDOWS\Microsoft.NET\Framework\v1.0.3423\Temporary ASP.NET Files

weijian
May 26th, 2002, 03:14 PM
Yes, but what mandreko is requesting is using code behind, how to make the dll manually, and how to reference it in a aspx page. What's your point? :confused: The article answers quite a number of questions posted.

mandreko
May 26th, 2002, 10:50 PM
I haven't had time to play with that example yet, but i'm not sure it does quite what i was asking about. It was my understanding that you could compile your code-behind, so that your client could still edit the aspx page, but you keep your code hidden from them, so that if you needed to, they would be unable to edit that.

Is my understanding wrong, or is that what's going on?

gijsj
May 27th, 2002, 01:21 PM
No, your understanding isn't wrong.
Try the following:

Create a Web App with an .aspx and its code-behind.
Then, go to Project -> Copy Project and select "Only files to run this application".
After you copied it some where check out the files in the directory, the code-behind files are compiled into an assembly and copied in the \bin directory.

mandreko
May 28th, 2002, 11:27 AM
and then once i have the assemblies in the bin folder, how do i go about publishing them? do the assemblies need to stay in a bin folder, or in the same directory as the aspx when i put them on a live IIS server?

Cander
May 28th, 2002, 11:33 AM
it needs to be in the bin folder in the root of the web application's virtual directory.

now how to make and use the dll.

just compile the code into a dll..then you can reference it like any other dll

Dim A as New namespace.class

a.method()

and so on.


It think this is what you want.