ASP.NET assemblies - running under a specific URL

  • Thread starter Leszek Taratuta
  • Start date
L

Leszek Taratuta

Hello,

I have an ASP.NET application as an assembly running on a specific website.
I would like to prevent anybody from using the application if they copy the
assembly to another website. The application should not start when copied to
a website other than specified.

The question is how to secure the assembly so it works only on a specified
URL?
What namespace in .NET framework should I use?
What technique should I utilize?

Thanks for any help,
Leszek Taratuta
 
N

Nicole Calinoiu

There are two possible approaches for this:

1. Screen request URLs for a permitted list of sites (by DNS name and IP).
2. Implement a licensing mechanism.

Of the two, #1 is easier to implement, but it's also much less flexible than
licensing. You should also keep in mind that both approaches are reasonably
simple to bypass by decompiling, modifying, then recompiling your
assemblies, and anyone who is willing to ignore contractual and/or licensing
agreements to copy your application is very likely willing to ignore similar
injunctions against decompliation.

That said, if you want to use the simplest implementation, adding a
BeginRequest event handler to screen for acceptable server addresses would
do the trick. For example, if you had an application that should only run
on the Microsoft site, you might want to use something like the following:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
bool allowRequest;

switch (Request.Url.Host.ToLower())
{
case "localhost":
case "127.0.0.1":
case "www.microsoft.com":
case "207.46.250.252":
allowRequest = true;
break;
default:
allowRequest = false;
break;
}

if (!allowRequest) throw new HttpException(404, null);
}

HTH,
Nicole
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top