NET Webforms

In general, choosing between ASP.NET MVC and ASP.NET can be based on the following ive criteria:

  • Are you considering test-driven development (TDD)?
  • TDD enables you to write tests for an application irst, after which the application logic is developed. An ASP.NET Webforms application uses only one class to display output and handle user input. Automated testing of this class is complex as you are required to load the full ASP.NET stack into a separate process (for example, in IIS). The MVC framework allows the testing of each component separately, without requiring the full ASP.NET stack. For example, you can test your model separately from your controller without requiring a view. If you are considering TDD, the ASP.NET MVC framework will be the better choice.

  • Is             there     a              need     for          fine        control  over       HTML    markup?
  • ASP.NET Webforms automatically inserts hidden HTML markup, IDs, JavaScript, and so on, into your page’s HTML output because of its event-driven architecture and its use of ViewState. The ASP.NET MVC framework allows for 100% control over the HTML output. If you require full control over your HTML markup, the ASP.NET MVC framework will be the better choice.

  • Is the application heavily data-driven?
  • If you are developing an application that is heavily data-driven and is using grids or a lot of master-detail editing of data, ASP.NET Webforms may be the better choice as it provides a lot of controls that will aid you in the development of these kind of applications. Of course, you can use the ASP.NET MVC framework for these tasks too, but you will be required to write more code to achieve the same goal.

  • Is there a need for a Winforms-like development approach?
  • Does your development team write Winforms code? Is there a need for an event-driven programming approach? In these cases, consider ASP.NET Webforms in favor of ASP.NET MVC.

  • Is there a need for a rapid application development (RAD)  development approach?
  • Does your client expect a quick prototype of an application? Is the use of drag-and-drop development using pre-created web controls required? If so, consider ASP.NET Webforms in favor of ASP.NET MVC.

if it is helpful, plese dont forget to leave a comment.

The ASP.NET MVC framework offers the following advantages:

  • Complexity of application logic is made easier to manage because of the separation of an application into model, view, and controller.
  • It allows for easier parallel development; each developer can work on a separate component of the MVC pattern.
  • It provides good support for TDD, mocking, and unit testing frameworks.
  • TDD enables you to write tests for an application irst, after which the  application logic is developed.
  • It does not use ViewState or server-based forms, which allows you to have full control over the application’s behavior and HTML markup.
  • It uses RESTful interfaces for URLs, which is better for SEO (Search Engine Optimization). REST is short for REpresentational State Transfer—the concept of using URLs as the link to a resource, which can be a controller action method, rather than to physical iles on the web server.A typical page size is small, because no unnecessary data is transferred in the form of hidden ViewState data. It integrates easily with client-side JavaScript frameworks such as jQuery  or ExtJS.

ASP.NET Webforms offers the following advantages:

  • It offers an event model over HTTP that is familiar to any developer. This event model also beneits the creation of business web applications.
  • It provides a lot of controls that are familiar to any developer—data components such as data grids and lists, validation controls, and so on.  These components are highly integrated in the development environment.
  • There are numerous third-party control vendors that can deliver almost any possible control.Being familiar to developers allows ASP.NET Webforms to facilitate rapid application development.
  • Functionality is concentrated per page. It uses ViewState and server-based forms, which makes state management easier.

if it is helpful, plese dont forget to leave a comment.

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
        StringBuilder str = new StringBuilder();
        str.Append("function test() { alert('Close!');}\n");
        string str2 = Convert.ToString(str);
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientscript", str2, true);

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">Test Page.


if it is helpful, plese dont forget to leave a comment.

Some days back when I was working on a simple application, I tried to implement form based security,  I started with a very simple scenario with only two pages

  1. SignIn.aspx
  2. Default.aspx

In my application only authenticated users were allowed to access “Default.aspx” page which is very easy to implement through form based security, for that I made a change in web.config like this:


<authentication mode=”Forms”>

            <forms loginUrl=”SignIn.aspx” name=”.ASPNETAUTH”></forms>



            <deny users=”?”/>





This shows if a user is not authenticated he/she will be redirected to “SignIn.aspx” page, which is very nice.

Then I tried to made it more usefull and I added a “SignUp.aspx” page, purpose of the page was very clear, If a user is not authenticated he can use “SignUp” page, but according to my settings in web.config file, accessing the “SignUp” page was not possible because user is only allowed to access “SignIn.aspx” page if he/she is not authenticated, after some googling a found this solution

<location path=”SignUp.aspx”>



                        <allow users=”*”/>





            <authentication mode=”Forms”>

                  <forms loginUrl=”SignIn.aspx” name=”.ASPNETAUTH”></forms>



<deny users=”?”/>



New for the Web

  • Dynamic IntelliSense for JavaScript with vastly superior performance and completeness relative to VS08
  • A new editor for web developers with code-focused productivity through HTML/ASP.Net snippets
  • Seamless packaging and publishing of web applications to hosted and enterprise IIS servers
  • Config transformations for packaging and deployment scenarios
  • Standards based CSS 2.1 rendering in Design View
  • Silverlight 3 support with interactive XAML designer
  • Multi-targeting support to build applications for ASP.NET 2.0, 3.5 and 4.0

Dynamic IntelliSense for JavaScript

This is one of the coolest features in Visual Studio 2010.  IntelliSense for dynamic languages like JavaScript has always be problematic.  Types and even functions can be added to classes dynamically at runtime.  Now in Visual Studio you’ll have IntelliSense on these dynamically created types.  Shown below is an example where jQuery was dynamically extended with a new detonate effect and the IntelliSense that follows.


Snippets for HTML and JavaScript

HTML, ASPX and JavaScript files now have full support for Visual Studio’s snippets.  No more having to type runat=”server” on every control.  There are hundreds of new snippets included in Visual Studio 2010.

For example field validation can now be added in just a few key strokes.  After the snippet is inserted you’ll only need to fill-in the unique pieces of information highlighted below.


Packaging and Deployment

Visual Studio 2010 now has the ability to completely package and deploy a web application including all it’s IIS settings, Databases and Application logic.

There is a new 1-click publishing experience that simplifies publishing and updating your sites.

In addition to 1-click publishing there are extensive packaging options to control what specific IIS settings you want included with your package.

You can even include custom database scripts to run when your package is installed.

As part of the packaging process you can also run custom transforms on web.config that allow you update any section of web.config with custom settings unique to the deployment.

For example you can replace database connection strings and web service end points.


CSS 2.1 Layout Rendering in Design View

The HTLM and ASPX designer has been updated with support for CSS 2.1 layout rendering including attribute selectors.  The designer will now faithfully render your CSS 2.1 standards compliant markup.

if it is helpful, plese dont forget to leave a comment.

It’s the next gen of next-gen applications. Visual Studio 2010 is being designed inside and out to give developers and development teams every advantage in getting groundbreaking applications to market—faster and easier than ever.

The Beta is coming soon.

Take a look at what we’re working on.

Enhanced User Experience

Enhanced User Experience

Microsoft Visual Studio 2010 delivers a modern, enhanced user experience that makes understanding the current context more natural.

  • Clear UI Organization
  • Reduced clutter and complexity
  • Improved editor
  • Better support for floating documents and windows
  • Enhanced document targeting
  • Focused animations for action feedback

SharePoint Development in Visual Studio 2010

Usability and functionality for SharePoint developers is much more advanced with this Visual Studio release.

  • Enhanced customization abilities with new templates, designers and explorers
  • Design your own association and initiation forms for workflows
  • F5 deployment and debugging for SharePoint apps
  • Easier SharePoint site navigation with Server Explorer

Democratizing Application Lifecycle Management

Democratizing Application Lifecycle Management

Visual Studio Team System 2010 delivers new capabilities for everyone on a project, including architects, developers, project managers and testers.

  • Discover existing code assets with the new Architecture Explorer
  • Design and share multiple diagram types, including use case, activity and sequence diagrams
  • Tooling for better documentation of test scenarios and more thorough collection of test data
  • Run tests impacted by a code change with the new Test Impact View
  • Gated check-in, branch visualization and build workflow allow for enhanced version control

Inspiring Developer Delight

Visual Studio has made application development more productive, efficient and flexible for both developers and companies. Visual Studio 2010 continues this legacy.

  • Contextual support helps developers better understand existing code – and write new code more efficiently
  • First class C++ development experience that helps developers navigate and understand complex C++ source bases
  • Build new Windows® 7 applications or upgrade existing applications
  • Enable Office tools to make your solutions more flexible and productive for specific needs

Web Development

Web Development

With Visual Studio 2010, we’re continuing our investment in great Web development tools.

  • A high-performance and standards-compliant JavaScript IntelliSense® engine
  • “One Click Deployment” that quickly publishes files and configuration settings from development machines to the final deployed site
  • Full support for Silverlight™ for cutting-edge, rich Internet applications

Cloud Development

With Windows Azure™ Tools for Visual Studio, it’s easy for developers to build, debug and deploy services and applications for Microsoft’s new cloud platform.

  • C# and VB Project Templates for building Cloud Services
  • Tools to change the Service Role configuration
  • Integrated local development via Development Fabric and Development Storage services
  • Debugging Cloud Service Roles running in the Development Fabric
  • Building and packaging of Cloud Service Packages
  • Browsing to the Azure Services Developer Portal

More Databases

More Databases

With the Visual Studio partner ecosystem, developers will now be able to work with IBM DB2 and Oracle databases in addition to Microsoft SQL Server™ databases.

IBM has committed to develop, sell and support a Database Schema Provider (DSP) to let developers working with DB2 on the Windows, Linux or Unix platforms do offline design, development, testing and change management using Visual Studio Team System 2010 Development Edition.

Quest Software have made a similar commitment develop, sell and support a DSP which will enable Oracle Developers to work with their databases just as easily.

Parallel Programming

Parallel programming is simplified, so both native- and managed-code developers can productively build innovative applications.

  • IDE support for parallel programming
  • Native C++ libraries that use lambda functions and align well with STL
  • Parallel Extensions to the .NET Framework offers support for imperative data and task parallelism, declarative data parallelism, and more
  • Resource management of the multicore hardware and task scheduling enabled by Concurrency Runtime
  • Parallel debugging windows and profiling views

if it is helpful, plese dont forget to leave a comment.

ASP.NET includes the TextBox control and the Validation controls which can be combined together to perform user input validation. The caveat is that the developer has to use two different controls to perform a simple validation. In this article we are going to create a custom TextBox control which will use different validation controls and reduce the complexity of using multiple controls.

Getting Started:

We have created a separate class library project called MyControlsLibrary which will host all the server controls. We will call our control RequiredTextBox control. The RequiredTextBox control will derive from the ASP.NET TextBox control and add the validators as composite controls. Let’s add a RequiredFieldValidator to the RequiredTextBox control.

Adding a RequiredFieldValidator to the RequiredTextBox Control:

Our first task is to add a RequiredFieldValidator to our new RequiredTextBox control. Here is the code:

public class RequiredTextBox : TextBox
public string RequiredTextBoxErrorMessage { get; set; }

private RequiredFieldValidator _requiredFieldValidator;

protected override void CreateChildControls()


private void CreateRequiredFieldValidator()
_requiredFieldValidator = new RequiredFieldValidator
ControlToValidate = ID,
ErrorMessage = RequiredTextBoxErrorMessage


protected override void Render(HtmlTextWriter writer)


The first thing to notice is the name of the property “RequiredTextBoxErrorMessage”. We have provided a descriptive property name instead of the simple “ErrorMessage”. The reason is that we will be adding other validators which will also have the ErrorMessage property. So, we are differentiating the validator error message properties by using descriptive names.

The CreateRequiredFieldValidator method is fired on the PreRender event and is used to create the RequiredFieldValidator control and then add it to the controls collection.

Using the RequiredTextBox Control:

Let’s use our new RequiredTextBox control on a ASP.NET page. The first thing that you must do is add a reference to the MyControlsLibrary class library project. Now, you need to register the assembly to the page so you can use the new RequiredTextBox control.

<%@ Register Assembly=”MyControlsLibrary” Namespace=”MyControlsLibrary” TagPrefix=”mycontrols” %>

And here is the usage of the control:

<form id=”form1″ runat=”server”>

<mycontrols:RequiredTextBox ID=”txtName” runat=”server” RequiredTextBoxErrorMessage=”This field cannot be left empty!” />


if it is helpful, plese dont forget to leave a comment.

« Previous PageNext Page »