Friday, August 21, 2009

Using ELMAH with ASP.NET MVC

link

Insert following part after configSections after third steps

<elmah>
<security allowRemoteAccess="yes" />
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
<errorMail
from="aaa@aaa.aa"
to="aaa@aaa.aa"
subject="ICM Exception ..."
async="true"
smtpPort="25"
smtpServer="0.0.0.0"
userName=""
password="" />
</elmah>

Test Credit Card Account Numbers

Visa 4111111111111111
Link

Thursday, August 6, 2009

Action Filter in MVC to solve problem of Authentication Timeout

Add an Action Filter in MVC to solve problem of Authentication Timeout. Once Authentication Timeout then redirect to another place.
public class AuthenticationTimeoutFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting( ActionExecutingContext filterContext ) {
HttpContext context = HttpContext.Current;
if (!context.User.Identity.IsAuthenticated)
{
context.Response.Redirect("~/ControllerName/ActionName");
}
base.OnActionExecuting ( filterContext );
}
}


Forms Authentication timeout default in ASP.NET 2.0

Wednesday, August 5, 2009

ASP.NET MVC Roadmap

ASP.NET MVC Roadmap
This is a high level roadmap for ASP.NET MVC featuring the areas we are investigating. We will continually update this as we post releases to the CodePlex site.
ASP.NET MVC 2
Theme: Improved Productivity and Enterprise Ready

Developing applications with ASP.NET MVC 2 is going to be more productive than with ASP.NET MVC 1.0 with the improvements being made in this version such as the Templated and Paging Helpers. Additionally, those working with ASP.NET MVC 2 in the enterprise will find that some of the unique needs of their environment will be addressed via the new Areas and AsyncController features.

Runtime
ASP.NET MVC 2 will take a runtime dependency on ASP.NET 3.5 SP1 as we plan to ship project templates and tooling for both Visual Studio 2008 and Visual Studio 2010.

Visual Studio 2010
Visual Studio 2010 Beta 1 support as an add-on (Sometime in June)
ASP.NET MVC 2 Preview 2 included in Visual Studio 2010 Beta 2
ASP.NET MVC 2 RTM included with Visual Studio 2010 RTM

Visual Studio 2008
Will continue to ship a standalone ASP.NET MVC 2 installer for Visual Studio 2008 with SP1
ASP.NET MVC 2 Features
Preview 1 - Early August
Templated Helpers - allow you to automatically associate edit and display elements with data types. For example, a date picker UI element can be automatically rendered every time data of type System.DateTime is used. This is similar to Field Templates in ASP.NET Dynamic Data.
Areas - provide a means of dividing a large web application into multiple projects, each of which can be developed in relative isolation. This helps developers manage the complexity of building a large application by providing a way to group related controllers and views.
Support for Data Annotations - Data Annotations enable attaching validation logic in a central location via metadata attributes applied directly to a model class. First introduced in ASP.NET Dynamic Data, these attributes are now integrated into the default model binder and provide a metadata driven means to validating user input.
Preview 2 and beyond
Client Validation - builds on top of the Templated Helpers and Data Annotations work done in Preview 1 to provide client-side validation based on the model's validation attributes. This provides for a more responsive experience for users filling out a form with validation.
Strongly-typed input helpers – allow generating form input fields using code expressions against the model. This allows the helpers to take advantage of Data Annotations attributes applied to the model and reduces errors caused by lack of strong typing such as typos.
Strongly-typed link helpers – allow developers to take advantage of Intellisense support (due to the strong typing) to discover which controllers and actions are available for linking.
Asynchronous Controller Actions - provides a programming model for writing actions that can call external resources without blocking a thread. This can increase the scalability of a site that needs to interact with web services and other external services.
Areas - continued refining of the Areas feature, enabling a single project approach for developers who wish to organize their application without requiring multiple projects.
Other Improvements - continue to fix known issues carried over from ASP.NET MVC 1.0 as well as ASP.NET MVC 2 Preview 1. Also including API improvements based on user feedback along with minor new features.

Tuesday, August 4, 2009

Microsoft Delivers ASP.NET MVC V2 Preview

Link

Microsoft releases a preview of Version 2 of its ASP.NET MVC Web application development system.

In a blog post on the release, Scott Guthrie, corporate vice president of Microsoft .NET Developer Platform, said the new ASP.NET MVC V2 preview works with .NET 3.5 Service Pack 1 and Visual Studio 2008, and "can be installed side-by-side on the same machine as ASP.NET MVC 1.0."

.....
ASP.NET MVC 2 includes support for a new feature called "areas" that Guthrie said enables developers to "more easily partition and group functionality across an MVC application."

Guthrie said:

Areas provide a means of grouping controllers and views to allow building subsections of a large application in relative isolation [from] other sections. Each area can be implemented as a separate ASP.NET MVC project which can then be referenced by the main application. This helps manage the complexity when building a large application and facilitates multiple teams working ... on a single application together.

In addition, "ASP.NET MVC 2 now includes built-in support for the DataAnnotation validation support that first shipped with .NET 3.5 SP1—and which is used with ASP.NET Dynamic Data and .NET RIA Services," Guthrie said. "DataAnnotations provides an easy way to declaratively add validation rules to Model and ViewModel classes within an application, and have automatic binding and UI helper validation support within ASP.NET MVC."

Moreover, Guthrie said, "In a future ASP.NET MVC 2 preview we are planning to ship the jQuery Validation plug-in as part of the default project template, and add support for the automatic client-side JavaScript enforcement of DataAnnotation validation rules as well. This will enable developers to easily add validation rules in one place on either a Model or ViewModel object, and have them be enforced both client- and server-side everywhere it is used within the application."

Also, ASP.NET MVC V2 includes new HTML user interface helpers that enable developers to "use strong-typed lambda expressions when referencing the view template's model object," Guthrie said in the post. "This enables better compile-time checking of views (so that bugs can be found at build-time as opposed to run-time), and also enables better code IntelliSense support within view templates."