Igor Kitsula - Developer

A Programmer Reference

 
  1  2  3  4  

All about MVC validation with jQuery or Validate model with Data Annotations using jQuery

There are a lot of articles about validation in MVC. I’ve tried all of them and tried to find optimal and nice solution to validate model defined with Entity Framework, using Data Annotation attributes and have client-side validation related to these attributes using jQuery validation plugin. Too much? :) I don’t think so. Here is the solution.

Read more...Read more...

URL Rewriter. Remove default.aspx from the URL

Search engines (like Google) see URL which ends with trail slash "/" and URL with default document (default.aspx) at the end of the same URL as two different pages with the same content, title, etc. So for SEO purposes it’s good to get rid of default page at the end of URL. Here is simple rule for URL Rewriter to sole this problem.

Read more...Read more...

Configure Expired Headers on IIS7

YSlow: "Web pages are becoming increasingly complex with more scripts, style sheets, images, and Flash on them. A first-time visit to a page may require several HTTP requests to load all the components. By using Expires headers these components become cacheable, which avoids unnecessary HTTP requests on subsequent page views. Expires headers are most often associated with images, but they can and should be used on all page components including scripts, style sheets, and Flash." More…

Read more...Read more...

Configure entity tags (ETags) on IIS7

YSlow: "Entity tags (ETags) are a mechanism web servers and the browser use to determine whether a component in the browser's cache matches one on the origin server. Since ETags are typically constructed using attributes that make them unique to a specific server hosting a site, the tags will not match when a browser gets the original component from one server and later tries to validate that component on a different server." More…

Read more...Read more...

Custom Role Provider for MVC

In previous article I explain how to create Custom Membership Provider to authorize user and protect controls and pages. But what if you want to show or protect some area, controller or page for specific group of users? For example allow access to Admin Panel only for admins.

Read more...Read more...

Custom Membership Provider for MVC

.NET Framework allow you authorization engine based on two layer security: users and roles. Most popular is SQL Membership Provider and it contains methods and properties specific to using SQL as a data store for membership information. But for standard Membership provider you should create separate database. To use users or contacts information from your DB for authentication users with standard .NET form authorization you can create Custom Membership Provider and Custom Role Provider. Today we will create simple Custom Membership Provider and I’ll show how to configure it for using in MVC.

Read more...Read more...

Rewriter. Redirect to with or without www

One of the good rules of SEO is to keep domain name of website the same. This rule include prefix www. To implement this rule we can use simple rule for URL Rewriter:

<rewrite>
   <rules>
     <rule name="Redirect to kitsula.com without www." stopProcessing="true">
       <match url=".*" />
       <conditions>
         <add input="{HTTP_HOST}" pattern="^www.kitsula.com$" />
       </conditions>
       <action type="Redirect" url="http://kitsula.com/{R:0}" redirectType="Permanent" />
     </rule>
   </rules>
</rewrite>
Read more...Read more...

Routing and Areas in MVC

Nowadays almost every web solution has backend management system like Admin Panel, Control Center, Dashboard, etc. In WebForms you can create folder and put security restriction to it. How about MVC? To achieve same functionality and for even better organization of solution structure you can use Areas. (Organizing an ASP.NET MVC Application using Areas). You can find a lot of information about using areas in MVC. I just want to show you how to use routing rules in solution contains areas.

Read more...Read more...
  1  2  3  4