Click here to Skip to main content
15,904,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi
i wanna recognize visitor of my site by unique id until a user cant register twice by a computer( a computer is important no user) . but if i save their ip it is not constant when they disconnect and connect again to the internet also i dont want to use cookie because user can delete it. i know that every computer in the word has a unique cpu id but i dont know how can i achieve to this id and how can i store it in web application ;
Posted
Updated 18-Feb-12 9:30am
v7
Comments
behrad110 18-Feb-12 15:10pm    
i can do it in win form but i dont know how can i implement it in web app
BillWoodruff 19-Feb-12 10:40am    
I personally feel that no browser, accessing the public web, should ever allow such a system call: imho you are describing a door that once opened could lead to a real security breach. Browsers run in "security sandboxes" for a reason, and so does SilverLight.

Now if this is on a controlled intranet, and you have admin privileges for the whole intranet, and can configure every browser to allow such calls ... okay.
behrad110 19-Feb-12 11:09am    
thank for response ;
can you help me that how can i do it by silverlight
BillWoodruff 19-Feb-12 21:50pm    
If this is a public website on the internet anyone can access, why aren't your needs met by using a standard sequence of getting a user to register a username and password, and their e-mail, getting the user to respond to an e-mail sent to them to verify the information, etc. ?

Second, you have not told us exactly what you mean by a "web application" here.

I suggest you submit a question in the SilverLight/WPF forum here on CP. In that question I suggest you describe exactly what the use context is very carefully.

Make sure you clarify whether you are a system administrator running a controlled intranet with full control over the server(s), and all hardware like routers, etc., or you are running a public web-site anyone can access.

If you are running a public web-site, are you doing any server-side programming yourself ?

I don't know enough about SilverLight to know if this is possible: I assume it is not possible, and I hope it is not possible !

You should also fully research the new WMI library in .NET. http://msdn.microsoft.com/en-us/library/windows/desktop/aa393964(v=vs.85).aspx
behrad110 20-Feb-12 3:15am    
yes; it is public website but its very important for me that a user cant register several times .of course (almost) it is impossible but the number of system that is accessible for a user is less than emails that he can make and register by it. i have visual Situation ; i have no idea that how i can force the user until only one time register.

I don't really like activex controls for security reasons (you have to explicit allow your browser to execute scripts) but this should work:

XML
<script type="text/javascript">
    var cpu_id = "";
    var get_cpuid = GetObject("winmgmts:{impersonationLevel=impersonate}");
    e = new Enumerator(get_cpuid.InstancesOf("Win32_Processor"));
    for(; !e.atEnd(); e.moveNext()) {
        var s = e.item();
        cpu_id = s.ProcessorID;
    }
</script>


using:

XML
<b>Client CPU-ID : </b><span id="show_cpu_id" />
<script type="text/javascript">
    document.getElementById("show_cpu_id").innerHTML = cpu_id;
</script>
 
Share this answer
 
Comments
behrad110 19-Feb-12 10:22am    
thanks a lot for your guidance but i get this error:
Microsoft JScript runtime error: Automation server can't create object
El_Codero 19-Feb-12 10:31am    
hm... could you try (in IE) internet options -> Security -> Custom -> Initialize and script ActiveX controls not marked as safe... -> set to enabled?
El_Codero 19-Feb-12 10:48am    
thx for vote does it work for you now? But as (we) recommended, it's not a good way with ActiveX. I think you should thought about another way to handle this ;)
behrad110 19-Feb-12 11:02am    
why have you this opinion? is it insecure ?
behrad110 19-Feb-12 10:52am    
your code is very nice .thank you my friend. but do enabling Initialize and script ActiveX controls decrease security?
Maybe you generate a unique id for each user which is coupled with the ip adress?
I think it's not working with ASP, that would be a deeper intervention in the users system.
It's really simple to get the id in desktop applications but it could be done with silverlight or type of ActiveX application for web.
 
Share this answer
 
v2
Comments
behrad110 19-Feb-12 9:54am    
any solution exists with javascript ?if you know activex approach i am glad that you present it
thank
If u could find a way to use ip n find mac address of tht pc using arp/rarp then ur prb is solved.
 
Share this answer
 
Comments
behrad110 19-Feb-12 9:59am    
but how do i do it.
I did it in my desktop app. But you can get an idea from it-

VB
Try

          Dim ThisCPUID As String = String.Empty
          Dim temp As String = String.Empty
          Dim mc As ManagementClass = New ManagementClass("Win32_Processor")
          Dim moc As ManagementObjectCollection = mc.GetInstances
          For Each mo As ManagementObject In moc
              If (ThisCPUID = String.Empty) Then

                  ThisCPUID = mo.Properties("Processorid").Value.ToString
                  ' Return ThisCPUID
                  MsgBox(ThisCPUID)
              End If
          Next

      Catch ex As Exception
          MsgBox(ex.Message)
      End Try
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900