Wednesday, December 21, 2011

Precompile Web Application Project

If you have a website project, you have the option to precompile the website. So, the website startup (in IIS) will be responsive. But, for Web Application project, you don't have such precompile option and you will have to do it manually.

Steps to precompile your Web Application project:
  1. Publish your project by right click on the project name and choose Publish.
  2. Choose "File System" in the Publish Method and specify the location.
  3. Once the publishing has completed, run the "Visual Studio Command Prompt (2010)" from the Windows Startup menu.
  4. Then, type the following command and press Enter.
                    aspnet_compiler -p WebApp -v / WebAppPrecompile

The above command will precompile the "WebApp" locally without creating the Virtual Directory in the IIS.

Reference:
http://msdn.microsoft.com/en-us/library/ms227976%28v=VS.90%29.aspx

Monday, December 12, 2011

Embedding WebBrowser control in WinForm

This is not something new but very useful in embedding the WebBrowser control in WinForm:

http://notions.okuda.ca/2009/06/11/calling-javascript-in-a-webbrowser-control-from-c/

Pros:

  1. Multi-media mash up without much GDI calls - you can add nice images, sound and video in your WinForm without having to use GDI api to draw the nice effect.
  2. Able to utilize JQuery (or JavaScript) - this allows you to develop application that shares some of the library that you have developed between the WinForm and ASP.net.
  3. Able to do fancy menu without going through the WPF/Silverlight route - just use all the HTML and JavaScript that you have already learned.
  4. No more "can't built nice control" any more.

Cons:

  1. Over-used of the JavaScript and HTML in WinForm might create chaos. It increases the difficulties in debugging.
  2. You must posses HTML, JavaScript and C# skills. Of course, you must have the SQL skill as well.