Can customer change env.IsDevelopment after production

Viewed 122

We're developing a website using Asp.Net Core 2.2 we have this block in our configuration to bypass the licensing tasks in development tests:

if (!env.IsDevelopment())
{
    //Do license checking stuff...
}

I was wondering is it possible for the customer to somehow make my application run in development mode and try to skip license checking? If yes, what is the best way to prevent it? Thanks.

2 Answers

Q: Is it possible for the customer to somehow make my application run in development mode?

A: Sure. There are several ways to do this, it's easy. For example, all you have to do is set the environment variable DOTNET_ENVIRONMENT. Or edit the settings file with notepad.

Q: If yes, what is the best way to prevent it?

A: Don't use runtime checks like "if (!env.IsDevelopment())".

One alternative is to substitute compile-time #ifdef. Another is to hard-code a global flag variable in your app. You've got lots of choices :)

update launchSettings.json file profile in the deployed environment is the only way, I guess.

Related