Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile web application project ascx into dll

Is it possible to compile a web application project .ascx (user control) into a dll?

I want to do the following:

  1. Use the same control in multiple websites
  2. Embed css and .js as resources into the control
  3. Be able to update super easy. If the user control updates, I just want to update 1 .dll

I have successfully followed this article, http://msdn.microsoft.com/en-us/library/aa479318.aspx.

However, that uses web site projects, and I cannot embed js css as resources into web site projects.

Any ideas? Am I going about this wrong, should I change the approach?

like image 770
cjburkha Avatar asked May 10 '10 20:05

cjburkha


People also ask

How do I open an ASCX file?

On the Website menu, go to Add New Item > Web User Control. Enter a name for the control, select the programming language you want to use, and click Add. By default, the . ascx file name extension is added to the control name.

What is ASCX CS file?

ASCX files are server-side Web application framework designed for Web development to produce dynamic Web pages.They like DLL codes but you can use there's TAGS You can write them once and use them in any places in your ASP pages.If you have a file named "Controll.ascx" then its code will named "Controll.ascx.cs".

What is ASCX in asp net?

ascx file, also known as a user control, requested from a server that hosts an ASP.NET Web application. The file must be called from a Web Forms page or a parser error will occur.


1 Answers

Another way would be to convert user control to the custom control. There is an nice article on MSDN: Turning an .ascx User Control into a Redistributable Custom Control which describes exactly how to do that. Here is the summary:

  1. Write your user control as you normally would, typically using the Visual Studio designer.
  2. Test it using a simple page before trying to deploy it.
  3. Deploy the application to precompile it.
  4. Grab the user control's assembly produced by the deployment step, and you're essentially done: You have your custom control.
  5. Finally, use your custom control in other apps the same way as you always use custom controls.

Hope this helps.

like image 99
Radek Stromský Avatar answered Oct 05 '22 17:10

Radek Stromský