Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6605545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:17:46+00:00 2026-05-25T19:17:46+00:00

I work on an ASP.Net application which is a web version of an already

  • 0

I work on an ASP.Net application which is a web version of an already existing winforms desktop application. The desktop application reads a license file defining enabled features to adapt its behavior. To lock the application to a specific machine, one of the setting of the license file is the serial number of the first system volume. At startup the application checks that the serial number in the license file matches the volume serial number. Getting the volume serial number is done by PInvoking kernel32.dll’s GetVolumeInformation function.
However in the asp.net version a standard application pool using a local service or local network identity does not have permission to PInvoke, resulting in the impossibility to check the license file is valid. How can I check the license at the application startup?

I can think of the following alternatives:

  • replacing the PInvoke by a method which does not require special permissions to get the volume serial number (is it the case with WMI?)
  • putting all the license checking code in a separate assembly and install it to the GAC to have it executed elevated
  • creating an application pool with administrator identity just for my application during the installation process

The first solution would be the best but I don’t know if it is possible.
Have I other possibilities? What are the pros and cons of each method? Which one is the best?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:17:47+00:00Added an answer on May 25, 2026 at 7:17 pm

    I suggest using WMI. The Win32_Volume class has the serial number of the volume. You can use something like this:

    using System.Management;
    SelectQuery query = new SelectQuery("Win32_Volume");
    ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
    foreach (ManagementObject obj in searcher.Get())
    {
        Console.WriteLine("{0} {1}", obj["DriveLetter"], obj["SerialNumber"]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

background: I work on an asp.net web application that is on a company intranet.
I have a web application (asp.net) where work items are submitted and allocated to
I've built an ASP.net web application which allows the users to view and make
I have a small C# ASP.NET web application which generates several PNG image files
I have an ASP.NET application which will be running in a web server (Windows
I have an ASP.NET 4.0 web application which uses a third-party API for external
We have an ASP.NET web application which uses ASP.NET Ajax. We open it from
I have an intranet ASP.NET web application in which I need to get the
I work on a fairly large ASP .NET Web Forms application that is currently
I'm introducing LESS into an existing ASP.NET web forms application. In order to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.