Posts

Showing posts from July, 2012

Multi Select List Asp.net MVC 3

full working example: Model: public class Item {     public int Id { get ; set ; }     public string Name { get ; set ; } } public class MyModel {     public IEnumerable SelectedItemIds { get ; set ; }     public IEnumerable < Item > AvailableItems {         get         {             return new []             {                 new Item { Id = 1 , Name = "Item 1" },                 new Item { Id = 2 , Name = "Item 2" },                 new Item { Id = 3 , Name = "Item 3" },             };         }     } } Controller: [ HandleError ] public class HomeController : Controller {     public ActionResult Index ()     {         var model = new MyModel         {             SelectedItemIds = new [] { 2 , 3 }         };         return View ( model );     }     [ HttpPost ]     public ActionResult Index ( IEnumerable selectedItemIds )     {  

Creating a Global Action Filter in asp.net MVC 3 and above

I Found a very nice and simple acticle of incorporating the Global Action filteres on your application. this acticle is as below. http://weblogs.asp.net/gunnarpeipman/archive/2010/08/15/asp-net-mvc-3-global-action-filters.aspx It also contains the source code required to try it out.

Asp.net ViewState Security

Asp.net ViewState Security. ASP.NET ViewState data is stored in a single Base64-encoded string  such as  this: id="__VIEWSTATE" value="dDw3NDg2NdTI5MDg7Ozr4="/> Since this value is not formatted in clear text, developers sometimes assume that their ViewState data is encrypted which is most certainly not the case. This data string can be reverse-engineered this and then viewed. This is an obvious security issue if sensitive data is being stored in ViewState. To make ViewState secure, there are two choices, hash codes and ViewState encryption. USE A HASH CODE. A hash code  is a cryptographically strong checksum. When you use a has code, ASP.NET calculates the checksum based on the current ViewState content data and then adds this to the hidden input field when the page  when is returned to the client.  On the page post back, ASP.NET then recalculates the checksum to  ensures a  match. If a malicious user were to  change the ViewState data, AS

Asp.net 2.0 Page Lifecycle

PreInit | Themse Initialized , Master Pages applied, controls skins applied, | Init | InitCompleted | CreateChildControls (if IsPostBack) Control/ViewStateLoaded(if IsPostBack) | PreLoad | Load | Server-Side Events Fired(If IsPostBack) | LoadComplete | CreateChildControls(If !IsPostBack) | PreRender | PreRenderComplete | Control/ViewState Saved | Render | Unload