ASP.NET Custom role provider

Easy guide to write your custom role provider

Merge splitted .mkv files

Learn how to merge splitted .mkv files (.mkv001,.mkv002...)

How to Zoom in and Zoom out your sql execution plan ?

Tool to tune your sql query

send .exe files with gmail

How to send files having blocked extension with Gmail ?

Multiple home pages in Internet explorer

How to set multiple home pages in internet explorer ?


Autocomplete extender not working with IIS 7 + and website with role based authorization defined : ASP.NET

Last week I came across a very weird scenario on my website which I am trying to migrate to IIS 7.5 . My website is configured on anonymous authentication and authorization is only restricted to specified roles in the application. E.g as shown in fig below.

But unfortunately my autocomplete extender stopped working. My Autocomplete.asmx is located in a folder called " Services " . I am getting a authentication challenge " 401.2 " when I tried to access the service ( .asmx ) through the URL.I tried to check all my handlers in IIS whether .asmx is a allowed extension and everything is configured correctly. Since I am receiving a authentication challenge , I decided to play with the authorization of the folder. I dont know the exact reason but unlike IIS 6 , IIS 7 + accesses the folder under a different user context ( May be network service, IUSR or something else ) . I tried to set the authorization to either "all users" or "all anonymous users " like in the figure below. If you come across this kind of situation, you can try.
I am trying to find out the user context under which autocomplete accesses its asmx.... but this one should help you..

If you are facing problems with autocomplete extender and its usage , let me know.

Need more tips and tricks ? For more Subscribe here or click here to get updates via email


How to change default search provider in Firefox ? go to google typing in address bar

A small yet useful firefox tweak .Lot of people find it annoying to see their default search being changed from Google to or to something else.

If you type something in your address bar instead of correct URL, it will go to the default search engine. Firefox by default comes with Google as its default search engine. But when you install some toolbar like ask toolbar. Yahoo toolbar ....,  it will change your default search engine. Lot of users find it quite annoying as there is no straight shortcut to change this. So How to change your default search provider to Google in Firefox ?
  • Type " about:config "  in the address bar of your Firefox.
  • You might recieve a screen like below if you are opening Firefox configuration for the first time. Just click on " I'll be careful, I promise "

  • In the screen that appears , you will see a filter textbox just below the address bar as shown in the fig below.

  • In the Filter textbox, please enter the following .
  • Now just Right click on the entry you see and Click on " Reset " . You should see the status being changed to " default.
  •  This should normally search in Google when you type in address. 
Now for the right side text box , to reset your search engine, just type the following in your filter box then type in the name of the search engine you wish to have as the default search engine ( Something like " Google "  or " Yahoo " )

Love Technade ? For more Subscribe here or click here to get updates via email


Google Chrome book review

The net has already started buzzing about the netbook with a Google " Chrome " OS. Chrome operating system is the search giants attempt to develop a Cloud oriented Operating system.  The chrome OS netbooks are going to make their debut on June 15 into the markets.

Why I say this is just another net book with Google flavour?

Kindle, Wi-Fi, Graphite, 6" Display with New E Ink Pearl Technology - includes Special Offers & Sponsored ScreensaversBecause Chrome OS does nothing like a Desktop OS except that both have a browser :P... You can only run your web based applications with the help of advanced Chrome browser.Since there is nothing for the OS to really do, starting up such a netbook will just a tip of a minute .

If you ask me about the applications , the focus obviously is on the Google based applications ( Google docs , Gmail blah blah ).  Well Google has really thought of a futuristic idea where they expect web based applications to server just like the desktop applications do today. They just wanted to facilitate this with the help of their Chrome browser.This open release of the software is known as Chromium OS – a play off the Chrome browser’s name.

Which notebooks will have Google Chrome OS ? What is the cost of Chrome Notebook ?

Samsung Series 5
Samsung Series 5
Acer Chromebook
Acer Chromebook (3G)

Consumer Price
429 $
499 $
349 $
Enterprise Price
28 $ per user / month
~ 31 $ per user / month
28 $ per user / month
~ 31 $ per user / month
Education Price (students)
20 $ per user / month
23 $ per user / month
20 $ per user / month
23 $ per user / month
Minimum contract
10 for Biz / Edu ; No limits on Consumer
10 for Biz / Edu ; No limits on Consumer
10 for Biz / Edu ; No limits on Consumer
10 for Biz / Edu ; No limits on Consumer
Included Data Limit
100 MB Monthly
100 MB Monthly

How is the hardware of Chrome notebook ?

Eventhough Chrome does not run a desktop OS , dont expect it to be as thin as a MacBook Air :). Its a bit thicker and has more weight than the Mac. People complained about a feel of the panels as well but it depends on the manufacturers.

The keyboard is a stripped version of normal laptop keyboard. There are no function keys. There are hard buttons to do things like go forward or backwards. The CAPS LOCK button has been replaced with a Search button.

The wireless adapter seems to be extremely good and connecting the internet is a piece of cake.. Thats the least we can expect from a netbook :)...

There are some printing woes reported by the people about Chrome notebook . You have to do something similar mentioned here
Certainly will raise some eye brows ...

Can I buy a Chrome notebook ?

If you want to show it to a couple of friends , I will say a Yes. Else wait for sometime to see the evolution. Everything it has been constructed for is still in evolution. Cloud has to go a long way to see everything on it. The could be more features installed into these notebook s based on feedback and with time .
 Love reading latest tech news ? For more Subscribe here or click here to get updates via email


What is Hybrid Boot ? Windows 8 News

There are lot of discussions going on the internet over a supposed to be windows leak which included some extra features like Live Mesh cloud sync , Hybrid boot ..

What is this Hybrid boot ?

Normally we use Hibernation in windows to achieve faster startup and to resume our work easily. Basically Hibernation saves the contents of your RAM to your hard disk to increase your start up speed.

Hybrid boot is a stripped version of conventional hibernate. Instead of storing the entire state of your machine, it only stores the current state of core Operating System files. This fastens the boot time of your Operating System when the next time you load it. Typically it would reduce the start up time to 20 sec as per some sources. But the time reduction would depend on the speed of disk, RAID setup ...

Hybrid boot will be enabled by default in Windows 8. You will not see the boot manager (in case if you have multiple OS ) when you use this option. But there is a manual possibility to disable this option in special cases.

Since it is still in build phase, this can be further improved at the time of release depending on the feedback Microsoft recieves.

Love reading latest tech news ? For more Subscribe here or click here to get updates via email


which is better ? ASP.NET MVC or WebForms : How to choose between MVC and Webforms ?

  • ASP.NET Web Forms vs MVC ! 
  • What is the difference between ASP.NET WebForms and ASP.NET MVC ? 
  • When should I really choose MVC vs when should I choose webforms !
These are questions that normally run in the mind of any .NET developer in the recent times ( Confusing them what to learn ). Well both are used to build the same stuff and both have enough capabilities to build applications except that the way they are developed, tested and maintained is different. If some so called expert comes to you and says both are used to build different stuff , then it could very well  be that he is not able to understand things correctly.

Let me present you a small table that tells you the differences between the both and simplify your queries . The green ones are the advantages and red ones can not be..

ASP.NET Web Forms
More control over HTML that is rendered to browser which means you can really generate cleaner HTML
Don’t offer such a fine control over the HTML that is rendered and most of the it gets dirtier that we know.
Superior separation between UI and code
UI and logic coupled with code making it complex
Supports Multiple View Engines. Reuse your model/ Controller and plug it to a different view engine.
A option to forget about :). Switching between views with lot of things ( Master page, user control , theme ) is not a cake walk.
No Viewstate meaning a smaller page size. Unavailability of viewstate has its disadvantage too.
The more persistent controls you need, the more your view state will be and hence your page size too.
Allows end to end Test driven development (TDD), easy implementation of Mocking.
Not so straight forward to do unit tests for everything especially for the logic tightly coupled with your UI.
Easy integration with client side libraries like Jquery
Integration is possible but switching will be a bit difficult.
Development does need more effort. Don’t expect it to happen in same pace as Web Forms.
Very Suitable for RAD (Rapid Application Development). Build small applications and quick prototypes. Ease of development for heavy LOB applications.
MVC is a complete new way of doing web design and development. It basically gives a abstraction on both.
Windows Form Style development. (Any one can do development).  Feel at ease with drag, drop and clicks .Great designer support.
A lot of training and required for the developers to divert their mindset from conventional event driven programming. Frameworks and other things have still to evolve.
Greater visual studio support, Availability of resources and developers, Availability of third party controls.

So If we really look into the above analysis, ASP.NET web forms is a bit complex with lot of things ( ViewState, Postback, Page lifecycle, Data Binding ) having to be put in one place. The more complex things you start to make, the more complex your pages will start to become. Where as MVC is more of trying to loosely couple your HTML (VIEW) with the rest of code.

MVC does help you in doing a TDD but that does not mean you cant write your applications with out unit tests. Keeping the myths apart, When do you really need to choose MVC or Web Forms ?

Choose ASP.NET Web Forms
  • More Test Driven Development (When you have to  validate everything you write )
  • More Control on HTML and need for separation ( Designing vs Code)
  • New large application (Especially build and evolve in long term)
·         Rapid Application Development ( RAD ) and less time to Market applications
·         Winforms like programming interface  ( Availability of Developers )
·         Heavy Data driven applications
·         Existing Web Forms application need not be migrated to MVC

Need more tips and tricks ? For more Subscribe here or click here to get updates via email


How to deal with "IIS Metabase and IIS6 Configuration Compatibility" ? : IIS 7 issues

Are you receiving any of the following errors ?

you need to install the "IIS Metabase and IIS6 Configuration Compatibility" feature under Internet Information Services-Web Management Tools-IIS 6 Management Capability to get the IIS6 ADSI provider installed.

Your project has been configured to work with IIS. Either you dont have IIS 6 metabase installed or your virtual directory is not configured as a application.

To access local IIS Web sites, you must run Visual Studio in the context of an administrator account.

If you are recieving any of these errors, you are in the right place to find a solution.

Well all of these errors occur because you either might be a newbie IIS 7 +  on Windows 7 or Windows Vista !

Let me help you dissolving each of these :) .. Lets start with the simplest one.

 To access local IIS Web sites, you must run Visual Studio in the context of an administrator account.

By default, Windows runs applications in a limited-rights user account even when you are logged on to the computer as an administrator.

To run Visual Studio with administrative permissions in Windows 7 or Vista
  •     In Windows 7 or Vista , click Start, click All Programs, and then locate Visual Studio.
  •     Right-click Microsoft Visual Studio, and then click Run as administrator.

you need to install the "IIS Metabase and IIS6 Configuration Compatibility" feature under Internet Information Services-Web Management Tools-IIS 6 Management Capability to get the IIS6 ADSI provider installed.

  • First of all , you should have sufficient administrative access to turn or turn off windows features.
  • If you have the admin previliges , Please go to control panel in Windows and select Programs as shown in figure below.

  • In the settings page that opens, please select Turn windows features on or off .
  • Now go to Internet Information Services and then :
    • Expand Web Management Tools, expand IIS 6 Management Compatibility, and then select the IIS 6 Metabase and IIS 6 configuration compatibility check box.
    • Expand World Wide Web Services, expand Application Development Features, and then select the ASP.NET check box.
    • Expand World Wide Web Services, expand Security, and then select the Windows Authentication check box.
    • To enable Visual Studio to debug applications, you must configure IIS 7.0 with the Windows Authentication module. By default, the module is not configured as part of IIS.
    • Click OK to start the IIS and ASP.NET installation process.
 If you have resolved the above two, and still get the third error, Your project has been configured to work with IIS. Either you dont have IIS 6 metabase installed or your virtual directory is not configured as a application.

 This is something very smallish but this is something that IIS 7 + has brought in. Well in IIS 6 its just a virtual directory setup thats enough to run a application. But in IIS 7 , you have to make it as a application as well.
 Right click on your virtual directory and click on Convert to Application and you should get rid of this.

If you do the above three steps, you should be able to run your application and debug it :)

Courtesy : MSDN

Our guide to your problems help you ? For more Subscribe here or click here to get updates via email

Roles in Windows Azure : What is web role and worker role ?

After reading a lot of stuff about evolution of cloud and its economics, I finally started learning some real life stuff in the cloud world. Well I looked out for Enterprise lineant cloud services and I genuinely felt Microsoft is the choice for that. To go deeper , I started learning about the Cloud Operating System by Microsoft which is , Microsoft Azure ( PaaS ) .

As I started out reading about the hosted services in Azure , I came across a term which is called Role. Being a ASP.NET web developer, I was just confused with this role terminology in Azure. After giving some thought I am able to understand what is. For confused people like me :D, here is its definition .

Applications built on Azure should use atleast one of the roles below.
  •  Web role – A web role is a role that is customized for web application programming as supported by IIS 7 and ASP.NET. The benefit of using this type of role is that the IIS setup is done for you automatically by Azure. This role is best used for providing a web based frontend for your hosted service. It is not suited for long running processes
  • Worker role – A worker role is a role that is useful for generalized development, and may perform background processing for a web role. When you have a need for a background process that performs long running or intermittent tasks, you should normally go for Worker Role.
  • VM role – A VM role is a special type of role that enables you to define the configuration and updates of the operating system for the virtual machine. While a web role and a worker role run in a virtual machine, the VM role is the virtual machine, which gives you full control of operations. When you have long and complicated installations in the operating system or special setup issues, you should use this role. This role is especially suited for migrating existing applications to run as hosted services in Windows Azure.
I hope these definitions would have definitely helped you in understanding the roles in Azure.

If you want to learn about Creating a hosted service on Azure, please go to this link.

For more information on Cloud Computing ,  Subscribe here or click here to get updates via email


How to enable windows authentication of IIS 7 + in Windows 7 or Vista ? No Windows authentication in IIS ?

I always had a Windows 7 Laptop at my home which I never used for development purposes. Today I installed Windows 7 enterprise version on my office laptop .  I created a website and wanted to set the authentication to Windows . Surprisingly I could see only anonymous authentication which is enabled by default. 

I remember sometime back I was modifying application host config file to play with windows Authentication settings on IIS 7.x .  The configurations of IIS 7 + is not as simple and straight forward as it used to be in IIS 6 and lower version ( Probably Microsoft wanted the IIS admin to be a Geek :) ). So How do we enable Windows authentication in IIS 7 for windows 7 or Vista ?
  • First of all , you should have sufficient administrative access to turn or turn off windows features.
  • If you have the admin previliges , Please go to control panel in Windows and select Programs as shown in figure below.

  • In the settings page that opens, please select Turn windows features on or off .
  • Now Navigate to Internet Information services --> World wide Web Services --> Security and there you should be able to see different kinds of authentications in a dialog window, just as shown in the figure below.

  • Now you can choose the type of authentication you want to be enabled on your IIS 7.x server.
  • If it is Windows authentication , please select windows authentication or if it is Basic authentication , select Basic authentication based on your need.
  • Click Ok after selection and let windows handle it.
  • Now close / Restart your IIS and you should be able to see the chosen authentication types in your IIS as below.

    Hope this has helped you.

    Need more tips and tricks ? For more Subscribe here or click here to get updates via email


how to find column dependencies in SQL server ? SQL server 2005 / 2008

Did you ever want to find the dependencies of a column in all the tables and stored procedures in the database ! It helps you sometimes in finding the impact of the changes you want to make very easily. May be if you dont know about the database, it would help you understand the size of the changes you want to make.

Its very simple. All you need to do is just fire this query :)...

select name
from syscomments c
join sysobjects o on =
where TEXT like '%TableName%' and TEXT like '%ColumnName%'

Replace the Table name and the column name with the  name of the table where the column is and the column name itself.

What is syscomments ?

As per MSDN, syscomments contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedure within the database. The text column contains the original SQL definition statements.

What is Sysobjects ?

Sysobjects contains one row for each object that is created within a database, such as a constraint, default, log, rule, and stored procedure.

These are part of system views which you can find in the link below.

Love SQL server tips ? For more Subscribe here or click here to get updates via email


Efficient SQL server query tuning with SQL sentry Plan Explorer : Zoom in Zoom out SQL plan

A day back I had to fine tune a sql query which was way too complex to analyze with a glance. It would take endless time to do that by analyzing just the statements as I was dealing with a couple of million records..

So I decided to start using the tools available in Sql server Management Studio (SSMS) for fine tuning the query. For finding the cost associated with my query, I ran my query with my actual execution Plan set to On. When I ran the query, SSMS displayed the execution plan in the bottom pane of SSMS. Since My query is complex, so my execution plan looked like a train with 100 coaches :)...Navigating through the plan displayed in SSMS was so difficult. I could not make anything out of it. So I tried to find out tools which would help me to understand this plan in a efficient way and do some tuning with it.

I came across a wonderful tool ( Freeware ) which helped me in fine tuning my sql query easily.

SQL Sentry Plan Explorer is a lightweight standalone app that builds a graphical view using SQL query plan so that developers can understand it very easily. It does not require a collector service or database.

The image below explains how well the graphical view is constructed. Please click on the image to enlarge it

It helps us understand which elements in the plan costs more by displaying them in different colors ( Red for high cost, yellow for medium cost...)... It even displays the amount of data that flows between different elements to help you understand where you have more data. All you need to do is tweak accordingly and check the costs again.

How to load your plan into SQL sentry Plan explorer ?

There are different ways through which you can load your execution plan into SQL sentry plan explorer.

  • In SSMS, right-click a graphical plan and select “Show Execution Plan XML”, then copy and paste the plan XML into the Plan Explorer. It doesn’t matter which pane is active, the clipboard handler is global and will auto-detect the plan XML.
  • Save an execution plan from SSMS to a .sqlplan file, then open the file using the Open toolbar button, File->Open menu, or Ctrl + O. Raw plan XML files and .QueryAnalysis files (our own proprietary format) are also supported.
  • Right-click an existing .sqlplan file in Windows Explorer and select “Open with -> SQL Sentry Plan Explorer”.
  • Drag-and-drop a plan file onto the application (The easiest way !)
The sentry plan explorer offers you different views of the plan tree namely :
  • Plan Diagram
  • Plan Tree - A tree representation of the plan which shows all operations and associated metrics
  • Top Operations - List of all plan operations, sorted by total estimated cost by default in descending Order
  • Query Columns - List of all columns accessed by the query along with the table, operation, and index used.
The best part of this is that you can zoom in and zoom out SQL query execution plan which lets you to view your plan in a glance. Its definitely lot better than SSMS plan viewer.

Need more tips and tricks ? For more Subscribe here or click here to get updates via email

If you want detailed description , please check here.


How to write your custom role provider in ASP.NET : Role provider for oracle

Did you ever have to get the user membership information / Role information from a custom table in a database other than ASPNET SQL db ... Something like you want to get the information about user role from a userinfo procedure !!

There are two primary reasons that might make you look at creating a custom role provider.

* You need to store role information in a data source that is not supported by the role providers included with the .NET Framework, such as a teradata database, an Oracle database etc...

* You need to manage role information using a database schema that is different from the database schema used by the providers that ship with the .NET Framework. E,g May be your company uses a custom schema for role authorization..

So how difficult is it to write your own custom role provider in ASP.NET ??

Believe me its as easier as drinking a glass of water :)....A Custom RoleProvider inherits from the abstract base class RoleProvider and has a number of optional methods and properties that can be overrriden.

Follow the steps below to create your own custom role provider !!

1. Add a new class to your project and name it as Something like "CustomRoleProvider".
2. Make sure you inherit the class from Abstract class Role Provider.

public class CustomRoleProvider : RoleProvider
/// This method will override the getrolesforuser method in roleprovider and do the custom implementation

public override string[] GetRolesForUser(string username)

List<string> roles = new List<string>();
//Write your own implementation and add roles returned by your methond to role array
return roles.ToArray();

public override void AddUsersToRoles(string[] usernames, string[] roleNames)

throw new NotImplementedException();


You can choose the methods for which you want to implement in the role provide class. Now your Custom role provider class is ready. Now you need to modify your web.config.

3, You need to enable the custom role provider and let your application know that the Custom role provider is its default role provider. So please add the following section to your web.config in <system.web> section.

<roleManager enabled="true" defaultProvider="RapidRoleProvider" cacheRolesInCookie="true"

<add name="RapidRoleProvider" type="CustomeRoleProvider"/>

If you are using namespace in your web application, make sure you give full directive of the class location in type ... Namespace.ClassName ....

You can see that we are caching the roles in a protected cookie which expires periodically. Once you set Cacherolesincookie = true , your role provider will not reach your datbase everytime user requests for a resource. Instead it checks in the cookie and fetches the result fastly. The advantage is the improvement in performance of the application.

4. Now you are done with your custom role provider and you are ready to use it.. Lets make a small test using declarative security attributes. Lets take some page which is only accessible to user role "Normal".

[PrincipalPermission(SecurityAction.Demand, Role = "Normal")]

public partial class Default : System.Web.UI.Page


// ...


When a user tries to access the above page, the GetRolesForUser Method in CustomRoleProvider will be called to verify the user is assigned to the “Normal” Role. If so, the page works fine. If not, a SecurityException will be thrown, not allowing the page to be viewed.

Now your role provider works fine.So you can enable security trimming on your sitemap and implement role based security in your application.

If you have any doubts / Questions, please feel free to leave your comment.

Need more tips and tricks ? For more Subscribe here or click here to get updates via email