How can I obtain the client MAC address with C# code of someone who visits my website?
You don't have access to the MAC, you don't need it. The MAC is only known to the router who the computer is connected to.
You can't get the MAC address of the sender, because you can't get mac address behind the first router on the path to the client.
To achieve that, you have to run some code on the client machine. MAC address isn't provoided in the internet. Store some cookie with a guid on the machine, that is not as disliked as running code on the client machine. ;-)
The best thing in my oppinion is to establish a user management on your website and give the peaople a chance to register / login. Then you can track everything around the user.
Related
I have a web application (asp.net, C#) running for more than 2 months for internal employees of my company. The application was accessible by live IP address like 121.XXX.XX.200.
In my code-base, I used "HttpContext.Current.Request.Url.Authority" to get this particular IP address. This was also working fine till day before yesterday.
However, yesterday the code "HttpContext.Current.Request.Url.Authority" started giving me local IP address of the server like "10.X.XXX.20" instead of the live one.
Now I was able to reproduce the error. Whenever I browse the application using the local IP address, IIS seems to be caching the domain name. Now when I browse the same application using live IP address from different computer. It still gives me the local IP.
What can be the solution to this?
Try using HttpContext.Current.Request.Url.Host instead of HttpContext.Current.Request.Url.Authority.
As long as I remember Authority gets the DNS domain name of host which can cause problems sometimes.
I have an application which is working with generated licence (Mac-Id and some other hardware adresses). Everything works fine but if the user changes the internet connection from cable internet to Wlan connection or vice versa it gives a licence error. I know mac address will be changed if the internet connection is changed.
Is there a known solution ?
Any idea for this problem would be appreciated.
Using mac address is not a good idea cause users can change it manually. In your case Wireless NIC and Ethernet NIC has two different MAC addresses, So you should remember which one you used or not use MAC address at all.
I think you could enumerate all MAC address instead of using the MAC address of the active connection.
Also, this large post about How are Software License Keys generated? is quite worth a look.
I am on machine "MACHINEA" in my WiFi or LAN network, and am trying to authenticate a user with username "testusername" and password "testpassword" on machine "MACHINEB" in my WiFi network. I don't have a domain controller on this network. I want to validate credentials on a regular machine, just because it is visible on the network. I would like a solution or suggestion in C#, but I am open to other suggestions in other languages if I can fork into a different process that can return a value to me in a different language (if possible, please explain how I could do this as well).
I don't know what the equivalent in C# is but in C you can do this using the WNetAddConnection2 function. Note that this requires that you don't already have a connection to the computer, and that the computer is configured for authentication (i.e. simple file sharing is turned off.) You don't need to specify a local name for the connection.
What i want is :
There is one windows app ( made in .NET 3.5, VS2008, C# ) for Windows XP SP2 & SP3
generally users can change there IP or modify their IP Address.
Now,when my apps starts i dont want users to change there IP Address untill my app stops.
Hope now question would be clear.
Need your advice soon.
Recommend solution in C# .NET or VB.NET only.
generally users can change there IP or modify their IP Address.
No they don't, it is a very privileged operation. An administrator account is necessary. On Vista and Win7 the UAC prompt has to be acknowledged. Preventing an admin from administering the machine is a lost cause and in general a hostile act. And pointless, the admin has all the required powers to kill your app.
Fix the real problem. The days that you could count on having your app run with an admin account are long gone. Anybody that runs Vista or Win7 is quickly going to uninstall your app.
I don't think there is much you can do to temporarily prevent users from changing their IP addresses.
On most machines the IP address is controlled by the DHCP server. If this server decides you need to change IP address, you have to follow or your connection is closed.
Administrators can change the IP address, you could remove a user from the admin group (but that does not prevent point 1). But that should mean you have a controlled user base (in an enterprise), and you should be allowed to do that. (And how are you going to put them back into the admin group if they are not an admin)?
Maybe the design of your application is wrong, if it depends on always having the same IP address. Or you should mention it in the "requirements".
For example: for un-interrupted "action", P2P clients (like Bittorrent) depend on having the same IP address, but they do not enforcing this.
I don't think you can block the access, but you can monitor the IP address, and when it changes you can roll it back to the old IP using WMI.
How can I get the IP of a computer that connects to my Pocket-PC ?
I need to see this IP in my Pocket-PC.
I work on VS2008 C# Windows-mobile
Thanks in advance
The ActiveSync connection itself is an RNDIS network, so the device and the PC have their own addresses in that network. You can resolve "ppp-peer" to get the address of the PC in that network, but it won't tell you anything about the other network connection(s) of the PC.
To get that information, you would have to put an app on the PC that the device would talk to, and that app would provide the info you're after.