0

I have an Application where i need to find the current Log in Users Domain name in the server site, but my authentication mode is Form, kindly help me out.

ArK
  • 20,698
  • 67
  • 109
  • 136
lokanath das
  • 736
  • 1
  • 10
  • 35

1 Answers1

0

Finally i thought a nice way of solving the problem, and got it done too.

By using JS we can get the current system details then store it into a hidden filed and we can access the current system domain name & user name in the server side.

 function domain_Data() {
                var comdetails = new ActiveXObject("wscript.shell");
                var comusername = comdetails.ExpandEnvironmentStrings("%username%");
                var comusername1 = comdetails.ExpandEnvironmentStrings("%UserDomain%");

                var add = comusername1 + ":" + comusername;
                alert(add);
                document.getElementById("_hide").value = add;}
lokanath das
  • 736
  • 1
  • 10
  • 35
  • 1
    Problem here is that what if ActiveX is disabled? Then you are screwed :). Question is, what exactly are you trying to achieve here? What is the reasoning for having forms auth and wanting t oget the domain user account? – Ahmed ilyas Apr 08 '15 at 06:05
  • i have mentioned it on the question, need to get the user name and domain name of current user in server side..and my authentication mode is"FORM", by this one i completed the task.if disabled then need to think differently.. – lokanath das Apr 09 '15 at 07:03
  • 1
    you have not mentioned the REASON for doing this. – Ahmed ilyas Apr 09 '15 at 11:09
  • This is not a hacking :) ... The application requirement was to check weather the user who is login from the specified system(in organization) , is it the same person?we have LDAP check all those things, thus here we need to retrive the user details and make it check with the LDAP return values – lokanath das Apr 10 '15 at 09:15
  • right but in such a case, why use forms authentication? why not directly use Windows authentication? – Ahmed ilyas Apr 10 '15 at 10:00
  • yup, i had developed it in windows it self, but sometimes requirement is that kind we can't change it.i searched all technique nothing worked for me and finally i used this process after a long thinking.if you have any way to do it in form Authentication then that' ll be nice. – lokanath das Apr 13 '15 at 05:34