|
Validating Data Using Data Annotation Attributes in ASP.NET MVC |
|
The data entered by the end user in various form fields must be validated before it is saved in the database. Developers often use validation HTML helpers provided by ASP.NET MVC to perform the input validations. Additionally, you can also use data annotation attributes from the System.ComponentModel.DataAnnotations namespace to perform validations at the model level. Data annotation attributes are attached to the properties of the model class and enforce some validation criteria. They are capable of performing validation on the server side as well as on the client side. This article discusses the basics of using these attributes in an ASP.NET MVC application. |
|
Posted On : 20 Jun 2013 |
|
|
Preventing Cross Site Scripting Attacks in ASP.NET MVC 4 |
|
A website is exposed to various types of attacks and one of the most common types of attack is what is known as Cross Site Scripting (XSS). In a cross site scripting attack, malicious markup and script is entered in the web pages that are viewed by other users. If proper care is not taken to filter this malicious piece of markup, the script gets stored in the system and also rendered on web pages. Depending on the script injected by the hacker it can cause damage ranging from annoying popups to stolen credentials to accessing data stored in cookies. Therefore, it is important for ASP.NET MVC developers to prevent these types of attacks. Luckily, ASP.NET MVC offers a helping hand in safeguarding your websites. This article discusses some of the basics involved in the process. |
|
Posted On : 06 Jun 2013 |
|
|
Using Friendly URLs in ASP.NET Web Forms |
|
Websites often need to generate SEO friendly URLs. In ASP.NET Web Forms applications, a URL is tied to a physical .aspx file. This default mapping between a URL and physical file makes it difficult for Web Forms applications to generate SEO friendly URLs. One option available to ASP.NET developers is to use URL routing features. Alternatively they can also use Friendly Urls - a feature that allows you to quickly and easily use SEO friendly URLs in Web Forms applications. This article discusses how. |
|
Posted On : 02 Jun 2013 |
|
|
Select, Zip and Download Files displayed in a GridView |
|
Sometime back I wrote an article that shows how to zip and unzip files programmatically using System.IO.Compression classes. Using these classes along with ASP.NET controls you can allow user user to select one or more files from a list and then programmatically "bundle" these files into a ZIP achieve. This short post shows how. |
|
Posted On : 29 May 2013 |
|
|
Tricky issue with HTML5 drag and drop |
|
HTML5 supports native drag and drop through draggable property and several events such as dragstart, drag, dragenter, dragleave, dragover and drop. Normally dragstart event handler is where you set the data that is to be transferred between the drag source and drop target. The drop event handler is where you handle the drop of a drag source, access the data transferred and process it further. Now, in this particular case only the dragstart and drop events were handled. And the drop event handler never used to get called. In other words dragging operation was successful but dropping operation was not. |
|
Posted On : 21 May 2013 |
|
|
ASP.NET Web Forms, MVC, HTML5 Courses in Thane |
|
Dear Readers,
We are pleased to announce availability of brand new courses specifically designed for ASP.NET developers. These courses are based on the cutting edge technologies such as ASP.NET 4.5, ASP.NET MVC 4, HTML5 and jQuery. If you care about mastering web development using ASP.NET, these courses are for you. Check out our upcoming training schedule and book your seat today! Visit our training website for more details.
Regards,
Web Team
|
|
Posted On : 13 May 2013 |
|
|
Using Cross Origin Resource Sharing (CORS) in ASP.NET Web API |
|
For security reasons browsers prohibit AJAX calls to resources residing outside the current origin. This means you under the current settings, you can't provide a service exposed by a Web API to some other origin. However, at times you might want to allow a legitimate origin to access a resource. This is where Cross Origin Resource Sharing (CORS) specifications come into the picture. While there are other ways to enable CORS at the web application level, the ASP.NET Web API takes CORS support a step further through certain attributes. Using these attribute you can fine tune CORS at the global level, controller level or individual action level. This article discusses how this support can be used in your applications. |
|
Posted On : 11 May 2013 |
|
|
Zip and Unzip Files Programmatically in C# |
|
Most of us deal with Zip files on a daily basis. Normally people use some third-party utility to create, open and extract Zip files. At times you may want to deal with Zip files programmatically. Luckily, .NET framework 4.5 introduces some new classes in System.IO.Compression namespace that allows you to do just that. Using these classes you can create new Zip files, open and modify existing Zip files and extract the contents of Zip files via code. This article examines some of these classes. |
|
Posted On : 04 May 2013 |
|
|
Working with Arrays in C# |
|
Arrays are frequently used to store data of the same type. You can use arrays in C# in many different ways. Although single dimensional arrays are most commonly used, other varieties such as multidimensional arrays and jagged arrays are also available to C# developers. Additionally, the Array class comes in handy when it comes to sorting or searching an array. This article discusses all these types of arrays with examples of each. |
|
Posted On : 26 Apr 2013 |
|
|
Content Negotiation in Web API |
|
Whenever you access ASP.NET Web API from your client side script (JavaScript / jQuery) by default the data is returned in JSON format. However, in certain cases you may want to retrieve the data in XML format instead of JSON. On the server side, Web API determinses what data format to use for sending data to the client by doing what is known as Content Negotiation. Simply put, content negotiation is a process by which Web API inspects the incoming request and HTTP headers accompanying the request to figure out what response format(s) the client can understand. Based on this checking Web API sends the output. |
|
Posted On : 23 Apr 2013 |
|