Posts

Showing posts from 2016

Sql Interview Questions.

Image
1.What is the difference between clustered and non clustered index in SQL? There are mainly two type of indexes in SQL, Clustered index and non clustered index. The differences between these two indexes is very important from SQL performance perspective. 1) One table can have only one clustered index but it can have many non clusteredindex. (approximately 250). 2) clustered index determines how data is stored physically in table. Actually clustered index stores data in cluster, related data is stored together so it makes simple to retrieve data. 3) reading from a clustered index is much faster than reading from non clustered index from the same table. 4) clustered index sort and store data rows in the table or view based on their key value, while non cluster have a structure separate from the data row. 2.What is "TRIGGER" in SQL? Trigger allows you to execute a batch of SQL code when an insert, update or delete command is executed against a specific ...

Maintain Session For Login User Using ActionFilter in Asp.Net MVC

Action Filter Action filters contain logic that is executed before and after a controller action executes. 2methods we can override from the action filter. 1. OnActionExecuting :before execution 2. OnActionExecuted  :After execution Check session value on Action Filter 1. Create a class (e.g  SessionExpire ) derived from ActionFilterAttribute Class. public class SessionExpire:ActionFilterAttribute 2. Override the OnActionExecuting method in created class (SessionExpire) .        public override void OnActionExecuting(ActionExecutingContext filterContext) { ………. ………. } 3. In side this method check the session value is available or not, if not available then redirect to login page. public override void OnActionExecuting(ActionExecutingContext filterContext)     {         if ((HttpContext.Current.Session["UserName"] == null) ||                     ...