-
-
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.
http://www.bipinjoshi.net/articles/0a53f05f-b58c-47b1-a544-f032f5cfca58.aspx
-
-
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.
http://www.bipinjoshi.net/articles/7e79ca45-5bf7-4dc4-b97e-3fdbae06c988.aspx
-
-
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.
http://www.bipinjoshi.net/articles/4fabc773-ffeb-4ac9-8b12-e39bb72b9ddc.aspx
-
-
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
archive. This short post shows how.
http://www.bipinjoshi.net/articles/2cd48325-5523-4442-98a8-63f12dba567b.aspx
-
-
Recently a reader asked about a tricky issue with HTML5 drag and drop. The
issue is this:
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.
http://www.bipinjoshi.net/articles/9ce78d52-7927-4fce-9dbc-d0d3f2bd6f70.aspx
-
-
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.
http://www.bipinjoshi.net/articles/540c368a-74ae-4693-a093-545e693988db.aspx
-
-
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.
http://www.bipinjoshi.net/articles/30c37391-0d15-4772-a9fc-822579fcdcc0.aspx
-
-
Basics of using 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.
http://www.bipinjoshi.net/articles/88bfd8e6-59d6-49fe-8a36-284d11707460.aspx
-
-
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 lay 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.
http://www.bipinjoshi.net/articles/6ef2100b-6561-4997-9df5-0864c5f23a21.aspx
-
-
C# preprocessor
directives are commands that are meant for the C# compiler. Using
preprocessor directives you instruct the C# compiler to alter the
compilation process in some way. For example you may instruct the C#
compiler that a particular block of code be excluded from the
compilation process. This article examines several C# preprocessor
directives available, with an example of each.
http://www.bipinjoshi.net/articles/fa0768e3-0db2-4fa8-af2a-e0dc92fec6d3.aspx