Thursday, May 24, 2012
Monday, May 21, 2012
View State and Cookies
viewstate
The ViewState property provides a dictionary object for retaining values between multiple requests for the same page. This is the default method that the page uses to preserve page and control property values between round trips.
When the page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field, or multiple hidden fields if the amount of data stored in the ViewState property exceeds the specified value in the MaxPageStateFieldLength property. When the page is posted back to the server, the page parses the view-state string at page initialization and restores property information in the page.
You can store values in view state as well. For more information on using View State, see ASP.NET View State Overview. For recommendations about when you should use view state, seeASP.NET State Management Recommendations.
Cookies
<div class="subsection" xmlns="http://www.w3.org/1999/xhtml">
A cookie is a small amount of data that is stored either in a text file on the client file system or in-memory in the client browser session. It contains site-specific information that the server sends to the client along with page output. Cookies can be temporary (with specific expiration times and dates) or persistent.
You can use cookies to store information about a particular client, session, or application. The cookies are saved on the client device, and when the browser requests a page, the client sends the information in the cookie along with the request information. The server can read the cookie and extract its value. A typical use is to store a token (perhaps encrypted) indicating that the user has already been authenticated in your application.
What is are the difference between them?
A great article : How to Choose From Viewstate, Session, Application, Cache, and Cookies
Some good discussion about the difference between Session and Viewstate : Session Vs ViewState
Why we to go for MVC
There are various positive points to moving towards MVC
1. TDD support out of the box as most of the design is based on interfaces.
2. SEO friendly URL by design (though now this is possible in ASP.NET 4 as well)
3. No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4. Clean View Markup (no additional HTML emitted)
5. 100% extensible. You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6. Rich UI support (possible through client side JS libraries like jQuery UI and others). Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7. Session, JS, Ajax works. Validation is even more powerful with DataAnnotations and jquery.
8. Is MVC faster? Yes by default because of lack of viewstate and clean markup. But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9. Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though asp.net does has this to some extent)
10. Out of the box minimal IOC support.
11. Full control over rendered HTML
12. Pluggable architecture
13. And much more....
Couple of limitations (though not exactly)
1. Learning curve as most asp.net developers are used to windows form model for web development.
NOTE: Webforms is not bad. But by design it encourages many bad practices. A webform at the hands of careful developer is as or could be even more productive than MVC. Just my thought.
Additional readings at http://msdn.microsoft.com/en-us/magazine/dd942833.aspx
1. TDD support out of the box as most of the design is based on interfaces.
2. SEO friendly URL by design (though now this is possible in ASP.NET 4 as well)
3. No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4. Clean View Markup (no additional HTML emitted)
5. 100% extensible. You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6. Rich UI support (possible through client side JS libraries like jQuery UI and others). Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7. Session, JS, Ajax works. Validation is even more powerful with DataAnnotations and jquery.
8. Is MVC faster? Yes by default because of lack of viewstate and clean markup. But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9. Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though asp.net does has this to some extent)
10. Out of the box minimal IOC support.
11. Full control over rendered HTML
12. Pluggable architecture
13. And much more....
Couple of limitations (though not exactly)
1. Learning curve as most asp.net developers are used to windows form model for web development.
NOTE: Webforms is not bad. But by design it encourages many bad practices. A webform at the hands of careful developer is as or could be even more productive than MVC. Just my thought.
Additional readings at http://msdn.microsoft.com/en-us/magazine/dd942833.aspx
Thanks...
Authentication & authorization
Thursday, May 17, 2012
Moving Items from One ListBox to other ListBox using JQuery
Following script will move the selected items from one list box item to another list box item.
Markup:
Markup:
<asp:ListBox ID="lstBox1" runat="server" SelectionMode="Multiple">
<asp:ListItem Text="A" Value="1"></asp:ListItem>
<asp:ListItem Text="B" Value="2"></asp:ListItem>
<asp:ListItem Text="C" Value="3"></asp:ListItem>
<asp:ListItem Text="D" Value="4"></asp:ListItem>
</asp:ListBox>
<asp:Button ID="btnMoveRight" runat="server" Text=">>" />
<asp:Button ID="btnMoveLeft" runat="server" Text="<<" />
<asp:ListBox ID="lstBox2" runat="server" SelectionMode="Multiple">
<asp:ListItem Text="E" Value="5"></asp:ListItem>
<asp:ListItem Text="F" Value="6"></asp:ListItem>
<asp:ListItem Text="G" Value="7"></asp:ListItem>
<asp:ListItem Text="H" Value="8"></asp:ListItem>
</asp:ListBox>
JQuery script:
$(document).ready(function() {
$('#<%=btnMoveRight.ClientID %>').click(function() {
var selectedOptions = $('#<%=lstBox1.ClientID %> option:selected');
if (selectedOptions.length == 0) {
alert("Please select option to move");
return false;
}
$('#<%=lstBox2.ClientID %>').append($(selectedOptions).clone());
$(selectedOptions).remove();
return false;
});
$('#<%=btnMoveLeft.ClientID %>').click(function() {
var selectedOptions = $('#<%=lstBox2.ClientID %> option:selected');
if (selectedOptions.length == 0) {
alert("Please select option to move");
return false;
}
$('#<%=lstBox1.ClientID %>').append($(selectedOptions).clone());
$(selectedOptions).remove();
return false;
});
});
ASP.NET Open Source Projects
Links to ASP.NET Open Source Projects
Blogs
- Blogsa.net - A blog engine in Asp.net.
- dasBlog
- BlogEngine.NET - Very functional, simple and clean Blog engine in ASP .Net 3.5.
- SubText - A blogging engine in ASP.NET.
- Owlpal - Web Content System.
- AtomSite (formerly BlogSvc) - Built using ASP.NET MVC.
- Oxite - Built using ASP.NET MVC.
Content Management Systems
e-Commerce
- nopCommerce - eCommerce platform similar to Magento
- dashComemrce - Open Source E-Commerce
Controls/Toolkits/Frameworks
- AJAX Control Toolkit - A control library for ASP.NET built over the MS AJAX Extensions for ASP.NET.
- ASP.NET MVC Project Awesome - A helper (controls) library for ASP.NET MVC built using jQuery.
- ASP.NET 3.5 MVC
- PokeIn - Comet Ajax Library.
- Gaia Ajax - An Ajax Framework for ASP.NET. Write C# or VB.NET; no JavaScript skills necessary.
- Evolutility - metadata-driven CRUD Framework.
- CSS Friendly Control Adapters
- RIAnimation - jQuery Animation library in ASP.NET.
- ASP.NET Ribbon - Open Source ASP.NET Ribbon that looks like Office Web Apps, SharePoint 2010 and Office 2010.
- Enterprise Library - Application blocks from the patterns and practices team.
- Rich Text Editor
- CSLA.net - Rocky Lhotka on CSLA.NET and ASP.NET
- Castle Project
- Email Reporter: VSTS 2008 Load Test Plug-in
- Typps - A complete Rich Text Html Editor, Image Picker, Color Picker & Image Viewer for ASP.NET.
- NPOI - Components which can help you read/write xls, doc, ppt files.
- Web Forms MVP - Testable Web Forms development
- Navigation for ASP.NET Web Forms - Manages movement and data passing between aspx Pages in a unit testable manner.
- asp.net Ajax File Manager Free open source file manager for asp.net full ajax support available for tinymce, Ajax control toolkit editor and stand alone.
- DJME2 - The jQuery extensions for ASP.NET MVC is a lightweight framework which helps you build rich user interfaces for ASP.NET MVC while enjoying great developer productivity.
Forums
- YetAnotherForum
- PunBB.NET - Open source forum engine. Created using ASP.NET 2.0. Feel free to join!
Galleries
- Gallery Server Pro - Share photos, video, audio, and documents.
Starter Kits
- ASP.NET Design Patterns - ASP.NET MVC 2 Case Study Starter Kit
Case study to show the use of GoF Design Patterns, SOLID Design Principles and Fowlers Enterprise Patterns in the context of an ASP.NET E-commerce application. - BeerHouse: CMS and E-commerce Starter Kit
- Classifieds
- Club Site Starter Kit
- Extended Club Site Starter Kit
- Codeplex Club Site Starter Kit
- DotShoppingCart
- Employee Info Starter Kit
- Job Site
- My Web Pages Starter Kit
- Personal Site Starter Kit
- Small Business Starter Kit
- StockTrader Sample Application
- Time Tracker Starter Kit
- Navigation NerdDinner
Conversion of the ASP.NET MVC NerdDinner application to ASP.NET Web Forms.
Wikis
Miscellaneous
- ASP.NET 3.5 GeoTwitter Alpha Released
- BugTracker.NET - An ASP.NET based bug tracking application.
- BugNET - Another ASP.NET based bug tracking application.
- ADefHelpDesk - Help Desk / Ticket Tracker Module (DotNetNuke and Standard ASP.NET Application versions)
- DinnerNow
- DropThings
- Live Chat Support Open Source
- SplendidCRM - Full-featured CRM written in C#
- LINQ to Twitter - LINQ to Twitter is an open source LINQ Provider for the Twitter micro-blogging service.
- ASProxy - An ASP.NET based web proxy.
Additional Projects
- http://asp.net/community/projects/
- http://www.codeplex.com/
- http://csharp-source.net/
- http://www.codeplex.com/nexus - Open source igoogle/pageflakes like application
refer from wiki article
Mobile Applications
ASP.NET 2.0 enables you to easily create applications targeting such devices.
The following links give you a head start on mobile application development with ASP.NET:
- .NET Mobile Tutorial
- Building Mobile Web Applications with .NET Mobile Web SDK & ASP.NET
- ASP.NET For Mobiles
- ASP.NET Mobile Web Development Overview
- Introduction to ASP.NET Mobile
- Code Project Article
Since most developers will not actually use cellular devices to test their mobile applications, device emulators have been created by companies like Microsoft, Nokia and others for testing purposes. A device emulator is software that simulates a mobile device. The Visual Studio IDE includes built-in emulator SDKs for Pocket PC and SmartPhone.
Working with Device Emulators:
Podcasts:
- ASP.NET Podcast Show #7
- Podcasts at Mobiledevcater - A podcast on some basics of mobile development.
Mobile-enabled Web Forms, MVC application samples
Wednesday, May 9, 2012
Linq to sql or Entity Framework
Entity Framework:
1. Enterprise Development
2. Works with Conceptual model of database
3. Works with all data sources
4. ".EDMX" is created while using Entity Framework
LINQ:
1. Rapid Application Development
2. Works with objects in database
3. Mainly woks with SQL Server
4. ".dbml" is created while using LINQ to SQL
Entity Framework is more targeted towards Enterprise Development where the schema is usually optimized for storage considerations like performance consistency and partitioning. Entity Framework is designed around exposing an application-oriented data model that is loosely coupled and may differ from the existing database schema. For example, you can map a single entity (class) to multiple or map multiple entities to the same table. Entity Framework has “.edmx” (ADO.NET Entity Model) file when added in the application.
LINQ to SQL mainly has features to support Rapid Application Development against SQL Server. LINQ to SQL allows you to have a strongly typed view of your existing database schema. You can build LINQ queries over tables and return results as strong typed objects. LINQ to SQL has “.dbml”(LINQ to SQL) file when added in the application. You can use LINQ to SQL by decorating the existing classes with the attributes.
Please review: Entity Framework Basics
2. Works with Conceptual model of database
3. Works with all data sources
4. ".EDMX" is created while using Entity Framework
LINQ:
1. Rapid Application Development
2. Works with objects in database
3. Mainly woks with SQL Server
4. ".dbml" is created while using LINQ to SQL
Entity Framework is more targeted towards Enterprise Development where the schema is usually optimized for storage considerations like performance consistency and partitioning. Entity Framework is designed around exposing an application-oriented data model that is loosely coupled and may differ from the existing database schema. For example, you can map a single entity (class) to multiple or map multiple entities to the same table. Entity Framework has “.edmx” (ADO.NET Entity Model) file when added in the application.
LINQ to SQL mainly has features to support Rapid Application Development against SQL Server. LINQ to SQL allows you to have a strongly typed view of your existing database schema. You can build LINQ queries over tables and return results as strong typed objects. LINQ to SQL has “.dbml”(LINQ to SQL) file when added in the application. You can use LINQ to SQL by decorating the existing classes with the attributes.
Please review: Entity Framework Basics
Tuesday, May 8, 2012
.Net Framework Versions
Version | Version Number | Release Date | Visual Studio Framework | Operating System |
1.0 | 1.0.3705.0 | 13-02-2002 | Visual Studio .NET | Windows Server 2003 |
1.1 | 1.1.4322.573 | 24-04-2003 | Visual Studio .NET 2003 | Windows Server 2003 |
2.0 | 2.0.50727.42 | 07-11-2005 | Visual Studio 2005 | Windows Server 2003 R2 |
3.0 | 3.0.4506.30 | 06-11-2006 | Visual Studio 2005 | Windows Vista, Windows Server 2008 |
3.5 | 3.5.21022.8 | 19-11-2007 | Visual Studio 2008 | Windows 7, Windows Server 2008 R2 |
4.0 | 4.0.30319.1 | 12-04-2010 | Visual Studio 2010 | Windows 7, Windows Server 2008 R2 |
Now we can read about all the new functionality that we are making available as pat of ASP.NET 4.5 and Visual Studio 11 Developer Preview at the following page: http://www.asp.net/vnext/whats-new.
Thanks...
Subscribe to:
Posts (Atom)