Are there any ways to encrypted a project in ASP.NET, so my customers can not change change the function where it checks the license code?
use Dotfuscator Community Edition that ships with VS. Also put checksum function to check if your EXE is changed or not.
No, it is not possible.
You can implement certain things that make it more difficult for customers to reverse or alter your program, in order such that it becomes cost-prohibitive to attempt such reversing or altering. But you cannot prevent them, if they are sufficiently determined, from reversing or altering your program.
Not if the customers are persistent and have even a modicum of skill. Obfuscation can only get you so far. Any .Net assembly can be decompiled.
See here for info: http://aspnet.4guysfromrolla.com/articles/080404-1.aspx
Added
Also, see this previous question: http://stackoverflow.com/questions/2525/best-net-obfuscation-tools-strategy
Take a look at Eziriz's .NET Reactor. It's pretty good at protection. From ther site:
.NET Reactor prevents decompilation by a variety of methods which convert your .NET assemblies into processes which no existing tool can decompile ( and which are also very likely to prevent decompilation by any future tool). .NET Reactor builds a native code wall between potential hackers and your .NET assemblies by producing a file which cannot be understood directly as CIL. Because the CIL in your assembly is emitted intact only at run time or design time (in a form in which the source is completely inaccessible), no tool is capable of decompiling .NET Reactor protected assemblies.
The native code wall created by .NET Reactor between the hacker and your source includes industry leading NecroBit technology, which is exclusive to .NET Reactor. .NET Reactor's protection has never been broken since the first release in 2004. These technologies make reconstruction of your source code more difficult by so many orders of magnitude that NecroBit is by far the most effective protection you can use for .NET assemblies.
A good obfuscation tool will hide your program logic (like the license checking code), symbol names, etc. Addiitonal settings such as tamper protection (the checksum function mentioned), string encryption, resource encryption should raise the bar further. This is enough to prevent 99% of people from tampering with your code and you should not lose sleep over the rest 1%. Take a look at Crypto Obfuscator which has all these features and protections.