Wednesday, December 31, 2014

You don’t see me…You see my Glamour


It’s been almost approx. 5 days I am riding a Glamour bike, well it’s a stylish bike! Ya the one which I was riding was of an ancient model may be of 2006 or something not very sure! It took almost 2 days for me to understand why I need to pull accelerator while doing kick start!! Oh! Ya.. It does not have a self-start but it`s an awesome bike… Sometime it is very rightly said Old is Gold and in case of bike if we maintain it correctly with timely servicing and everything then yes it would be awesome!!!

As a not very experience person in riding bike… something I noticed is that after a long ride I didn't come to know in which gear was I riding the bike whether it is 2nd , 3rd or 4th. Although I have used 4th gear very rarely but I wish there was an indicator nearby speedometer stating the gear in which I was riding the bike! I hope Motorcycle Company starts adding this feature inside the upcoming models!! Pardon me if it sounds foolish!!!

Now let’s start comparing what’s there in the Old Glamour and the new Glamour (Programmed Fi):

  1. Speedometer & Fuel Indicator: In old it is analogue and in new Fuel Indicator is digital (Now a days almost all new bikes come with digital Speedometer & Fuel Indicator well this bike is an exception?!?!)  It is noticeable that is why I have written!!
  2. Starting mechanism: This would be secondary thing the rider would notice in earlier model there was only kick start, but the new one comes with the Kick as well as self-start.
  3. Fuel Engine: The owner of the old bike said it can hold up-to 15 litter of fuel but the new one can only hold 12 litter + 1.5 litter! God knows whether the company thought of taking off the extra fuel space! Good if they have actually increased the mileage!!
  4. Last but not the least Brakes: Rear brakes remain the same whereas the front brake has been changed to disc brakes! So be bit careful for the front brake holders!!! or you may get a roller coaster effect!!!

Ahh..!! I can gulp all sorts of changes in the bike, car etc… But not the Mars kind of roads we have in India… hope that improves!!!


That’s all for the timing folks stay tuned for the upcoming posts...Cheers!!!

Saturday, July 27, 2013

Windows Authentication using ASP .Net in detail


Authentication



Authentication is the process of obtaining identification credentials such as name and password from a user and validating those credentials against some authority. If the credentials are valid, the entity that submitted the credentials is considered an authenticated identity.

In windows authentication users are authenticated against the users available in Windows operating system (local) or against that of users available in Active Directory.

For windows authentication we need to set the authentication mode to windows in web.config.
 


Now to impersonate the identity of IIS worker process to that of provided by Windows operating system
We will have to set the impersonate to True by adding <identity impersonate="true" />

So the final code will look like this





Now the question is how do I determine whether I am truly authenticated?  Basically I can twist my question into other way “How to get my username in Windows Authentication?” Well that’s pretty much simple I guess.

Well for that we will have to use System.Security.Principal namespace.
The code for getting complete username along with domain name as well as for getting only username/ userId is shown below:
  

C# Code:





VB Code:





So far we have seen how to get username/userid now the question is how to determine whether the user is authenticated?

Well for that there is a simple property IsAuthenticated in GetCurrent() of WindowsIdentity class.
A sample code for that is as below:



C# Code:





VB Code:





So far as I am concerned about authenticating a user things are fine Now what if I want to check whether it really works for some other user?

Ok for that case just go to Control Panel\User Accounts\User Accounts and inside that click on Manage User Accounts and click on add for adding a user.

  1. Say for if you want a add a user ‘durandose’.
  2. Then Go to Control Panel\User Accounts\User Accounts (In Windows 7 Professional)
  3. Now click on Add and now simply add a user ‘durandose’ select a domain if you want to add that person to a specific domain.
  4. Once you are done just click on ‘Next’ and select the roll etc.
  5. Now try login through that user and access that site, you should be able to get access to that page if everything has been done as per above instruction.
 Ok! If this was Windows Authentication!?! Then What would be Form Authentication, Passport Authentication and LDAP Authentication?!?! :D

Stay tuned for upcoming post!