Jan 4, 2011

Determine access to CRM using Windows Auth or Forms Auth(IFD)


Using IFD, we can configure CRM to work either using Forms Authentication or Windows Authentication. If users are inside the company network then they will be authenticated using Windows Authentication and they are outside company network then they will be authenticated using Forms Authentication.

Now if we need to know if user has logged using Windows Authentication or Forms Authentication, how can we do this? This can be done using small trick.

CRM has exposesd prependOrgName function which can be used to prepend organization name to your URL. PrependOrgName function prepends organization name in case user is accessing CRM from company’s intranet so it will be always blank when user access it from outside company’s network.

Here is how you will determine using prependOrgName var orgName = prependOrgName('');
if(orgName != ''){
alert('Form Authentication');
// Write your code here
alert('Windows Authentication');
// Write your code here

1 comment:

Cindy Dy said...

I am very happy to locate your website. I just wanted to thank you for the time you spent on this great article. I definitely enjoyed reading it and I have you bookmarked to check out new stuff you post.