Saturday, March 3, 2012

Microsoft .NET Web Programming: Web Sites versus Web Applications

In .NET 2.0, Microsoft introduced the Web Site. This was the default way to create a web Project in Visual Studio 2005. In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x

The Web Site is a file/folder based Project structure. It is designed such that pages are not compiled until they are requested ("on demand"). The advantages to the Web Site are:
1) It is designed to accommodate non-.NET Applications
2) Deployment is as simple as copying files to the target server
3) Any portion of the Web Site can be updated without requiring recompilation of the entire Site.

The Web Application is a .dll-based Project structure. ASP.NET pages and supporting files are compiled into assemblies that are then deployed to the target server. Advantages of the Web Application are:
1) Precompiled files do not expose code to an attacker
2) Precompiled files run faster because they are binary data (the Microsoft Intermediate Language, or MSIL) executed by the CLR (Common Language Runtime)
3) References, assemblies, and other project dependencies are built in to the compiled site and automatically managed. They do not need to be manually deployed and/or registered in the Global Assembly Cache: deployment does this for you

If you are planning on using automated build and deployment, such as the Team Foundation Server Team Build engine, you will need to have your code in the form of a Web Application. If you have a Web Site, it will not properly compile as a Web Application would. However, all is not lost: it is possible to work around the issue by adding a Web Deployment Project to your Solution and then:
a) configuring the Web Deployment Project to precompile your code; and
b) configuring your Team Build definition to use the Web Deployment Project as its source for compilation.

https://msevents.microsoft.com/cui/WebCastEventDetails.aspx?culture=en-US&EventID=1032380764&CountryCode=US

Thursday, March 1, 2012

Linq Tutorial

Microsoft LINQ Tutorials
http://www.deitel.com/ResourceCenters/Programming/MicrosoftLINQ/Tutorials/tabid/2673/Default.aspx

Introducing C# 3 – Part 4 LINQ
http://www.programmersheaven.com/2/CSharp3-4

101 LINQ Samples
http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx

What is LinQ
http://www.dotnetspider.com/forum/173039-what-linq-net.aspx

Beginners Guides
http://www.progtalk.com/viewarticle.aspx?articleid=68
http://www.programmersheaven.com/2/CSharp3-4
http://dotnetslackers.com/articles/csharp/introducinglinq1.aspx

Using Linq
http://weblogs.asp.net/scottgu/archive/2006/05/14/446412.aspx

Step By Step Articles
http://www.codeproject.com/KB/linq/linqtutorial.aspx
http://www.codeproject.com/KB/linq/linqtutorial2.aspx
http://www.codeproject.com/KB/linq/linqtutorial3.aspx

Sunday, February 12, 2012

Javascript Alert Message from code behind in ASP.NET

public static void ShowAlertMessage(string error)
{

Page page = HttpContext.Current.Handler as Page;
if (page != null)
{
error = error.Replace("'", "\'");
ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + error + "');", true);
}
}