Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Component for JavaScript Obfuscation?

Are there any .Net components for obfuscating JavaScript? I'm generating JavaScript dynamically & emitting via ClientScript.RegisterClientScriptBlock. I'd like to make it more difficult for others to view and modify that script.

Caveats:

  • Yes, I know that JavaScript obfuscation will merely inconvenience a serious developer.
  • I do intend to add (non-obfuscated) copyright notices.
  • My C# program that generates the JavaScript is my real value-add. That source won't be available to viewers. Nevertheless, I'd like to obscure the functions and data that it creates.

Thanks!

like image 484
Mark Maslar Avatar asked Dec 10 '09 11:12

Mark Maslar


2 Answers

You can call out to Google's Closure Compiler from .NET, here's an example:

  • http://madskristensen.net/post/Use-Googles-Closure-Compiler-in-C.aspx

Or there's a .NET port of the YUI Compressor:

  • http://www.codeplex.com/YUICompressor
like image 79
Chris Fulstow Avatar answered Oct 01 '22 21:10

Chris Fulstow


Try to use the YUI Compressor for .Net. It does not obfuscate, but it do compress at least. You use it as a dll.

http://yuicompressor.codeplex.com/

like image 41
Johan Wikström Avatar answered Oct 01 '22 20:10

Johan Wikström