May 2009


Some days back when I was working on a simple asp.net 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:

<system.web>

<authentication mode=”Forms”>

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

      </authentication>

      <authorization>

            <deny users=”?”/>

      </authorization>

</system.web>

 

 

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”>

            <system.web>

                  <authorization>

                        <allow users=”*”/>

                  </authorization>

            </system.web>

      </location>

      <system.web>

            <authentication mode=”Forms”>

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

            </authentication>

            <authorization>

<deny users=”?”/>

            </authorization>

</system.web>

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.

pic1

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.

pic2

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.

pic3

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.

Abstract:
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()

{
CreateRequiredFieldValidator();

base.CreateChildControls();
}
private void CreateRequiredFieldValidator()
{
_requiredFieldValidator = new RequiredFieldValidator
{
ControlToValidate = ID,
ErrorMessage = RequiredTextBoxErrorMessage
};

Controls.Add(_requiredFieldValidator);
}

protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
_requiredFieldValidator.RenderControl(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”>
<div>

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

</div>
</form>

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