Retrieving Device ID in ASPX.Page RRS feed

  • Question

  • Is there was way to retrieve the serial no or name of a mobile device connected to an ASP.Net web page (mobile or otherwise). I'd like to make my pages service an small pool of devices and I want to limit it to those devices. Sure certs are cool but they can be copied. I want the web site to respond only to the devices with certain serial numbers or device ids. I've tried the useragent but that didn't have the info I needed and the of the request object servervariables didn't either. Thanks.
    DJ Baby Anne's Biggest Fan................
    Sunday, May 17, 2009 1:38 AM


All replies

  • Assuming that you access the web server programatically, one possible way is to add your own header to the HTTP request.  For example, if you use the following code.  You can add your own header, in this case "DeviceID", to the HTTP request.  The header will be added to the rest of the default headers in the HTTP request.  You can then retrieve this header info on the server side.

                string strDeviceID = Guid.NewGuid().ToString();
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://www.yourserver.com");
                httpWebRequest.Headers.Add("DeviceID", strDeviceID);
                HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();

    why do you robot?
    • Proposed as answer by therobotgeek Sunday, May 17, 2009 2:28 AM
    Sunday, May 17, 2009 2:27 AM
  • Close. The problem is where do I store the guid for each device? I need the same value to be present for each device's unique ID - without using cookies. You may be on to something but the principle problem is how to retrieve the device ID from the mobile device which should remain constant and then persist this value in the headers as you described.
    DJ Baby Anne's Biggest Fan................
    Sunday, May 17, 2009 3:38 AM
  • Thx for the link Joel (both for this subject and the windows mobile site in general).  I looked it over and it seems that folks are having problems getting the same ID on different devices. Don't forget, in this scenario I'm trying to do it from an ASP.Net mobile page too. Is that possible?
    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 12:41 AM
  • Not unless you also have created an ActiveX component and [pre]installed it on the device to retrieve that information for you.
    Joel Ivory Johnson
    • Marked as answer by warrentang Friday, May 22, 2009 2:04 AM
    Monday, May 18, 2009 12:45 AM
  • Is there a way to get the deviceID on WM5/6 phone accessing a mobile page without active X? If not, how do I load active X controls on a PDA?
    DJ Baby Anne's Biggest Fan................
    • Merged by warrentang Wednesday, May 20, 2009 3:38 AM duplicate
    Monday, May 18, 2009 3:27 PM
  • I'm trying to stay away from Active X as it is one of those technologies that security nuts lock down right away. Is it the only way?

    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 3:29 PM
  • Hi,

    If you are talking Windows mobile page ( client based application) you dont need any activex.

    Please refer this link.


    Please let me know if my answer doest suit for your requirement.


    Monday, May 18, 2009 3:41 PM
  • I don't know that it would be "lcoked down" on windows mobile.  Unlike the desktop operating system ActiveX controls can't be installed automatically and silently upon browsing to a page. They would have to be installed the same as any other program.

    Access to ones hardware ID is itself considered a potential security risk and is not something that a web page will be able to do.  The most you would be able to query is the information that is in the device's request header (Which will normally identify the browser, versions of .Net installed, and other information the OEM may have added) and what ever you can query through JavaScript.

    Joel Ivory Johnson
    Monday, May 18, 2009 3:42 PM
  • So if I read your post right, I'd have to install the control via active sync. That means.......... I've got to create the ActiveX control for Windows Mobile. In .Net terms is does that mean Class library or something else?

    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 3:46 PM
  • No, I'm talk ASP.Net mobile web page.
    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 3:47 PM
  • And to make matters worse they say the function isn't guaranteed to be unique.The phone they cited in the page is the model I have!
    =O =[ =[ =[ =[
    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 3:51 PM
  • It doesn't mean anything in terms of .Net.  You can only do ActiveX components using C/C++.
    Joel Ivory Johnson
    Monday, May 18, 2009 4:21 PM
  • Now I'm really up the creek then..................
    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 5:51 PM
  • Why is it that you need to identify the device?  There may be other solutions that will meet your requirements.

    Joel Ivory Johnson
    Monday, May 18, 2009 6:14 PM
  • It's a way to license my software on a per device basis. Certificates, cookies and even a SQLCompact database can be copied from one device to another. If I can get a device ID, I can lock access to the user and the device.
    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 7:22 PM

  • I'm personally not a proponent of hardware based licensing since I've been burned by it before.  Shortly after purchasing some software my phone suffered a failure from a mechanical defect it had.  The phone provider gladly replaced it but  the process of relicensing the software was not a good experience.  I only bring up this story to ensure that you are aware of a pitfall of hardware based licensing.  That being said, also keep in mind that this type of licensing won't gaurantee that your software cannot be copied. 

    But in trying to go forward with your hardware based licensing you may want to just make a trial version of your software.  When the user decides to purchase it the trial can display a number that the user should type in when they are getting the full version of the software.  If you are allowing the user to complete the purchase on the device then you can open up the browser on the user's device to your purchase page and pass that number as a query string parameter so the user doesn't have to type it in. Either way that seems to be the path of least resistence for getting the hardware ID.

    If your software is for general availability you will probably want to ensure it is signed with a trusted certificate.  OTher wise you will encounter obstacles in trying to sell your software to individuals that have phones configured to require trusted certificates on executables.
    Joel Ivory Johnson
    Monday, May 18, 2009 7:38 PM
  • I see your point with respect to the pitfall of having the hardware crash. My plan for that scenario is to have the customer notify us at the time of the crash and then have them rerun the install after verifying the users license by name, device and some other identifer. I'll disable the orginal record of the license and old device id so when it comes on line again it can't access the web site. I'm wondering if the installs have the ability to retrieve deviceid for PDAs and Cellphones.

    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 8:28 PM
  • You can perform custom actions during an installation by umplementing them in a native DLL.  For a breif explanation see this : http://j2i.net/blogs/home/archive/2009/01/25/custom-actions-in-a-cab-installation.aspx

    Joel Ivory Johnson
    Monday, May 18, 2009 8:32 PM
  • Thx a million Joel! I'll check it out. I appreciate the help. Can this native dll return the device ID in VB.Net or do I have to go to C/C++?  I'd like to use vb.net here if possible.
    DJ Baby Anne's Biggest Fan................
    Monday, May 18, 2009 8:33 PM
  • You can only create the custom actions using C/C++.  VB.NET and C# can't be used for this task.
    Joel Ivory Johnson
    Tuesday, May 19, 2009 2:15 PM
  • Ouch.... that hurts.... I don't know C/C++ too well....  Anything in the works in integrate them into newer versions of the CAB installer?
    DJ Baby Anne's Biggest Fan................
    Tuesday, May 19, 2009 4:49 PM