Wrox Programmer Forums
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2008, 10:01 AM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lock Codes

Hi,
is there possible to lock source code?
i want to poblish some control source code.
i want to lock the source code, that user can only read it cann't be change it.
 
Old March 28th, 2008, 10:04 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I am not sure what you mean by "lock". If you compile your control down into a .dll this will prevent them from changing the code in the dll, however it wouldnt prevent them from disassembling it to get the source code.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old March 28th, 2008, 10:13 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

With .Net there is no guarenteed way to completely hide your source code. There are a few things you can do to stop people changing it however.

1) Obfuscate your code. Visual Studio comes with a simple .Net Obfuscator but other commercial products are available. This makes your source code very hard or impossible to understand.
2) Add an assembly key and strong sign your DLL. This means no-one could simply rerelease you DLL as their own without the private key.
3) Add a digital signature to your DLL. This would add the benefit of identifying you as owner of the code. Again, it couldn't be changed or altered without removing this.

/- Sam Judson : Wrox Technical Editor -/
 
Old March 28th, 2008, 12:06 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you are wanting to publish the source code itself then you aren't going to be able to "lock" it. If a user could read it they could always just copy/paste or re-type it to reproduce it. About the only thing you could do is make it more difficult for them to copy it. For example you could publish it as an image instead of as text. Then they'd be forced to reproduce it visually.

-Peter
peterlanoie.blog
 
Old March 28th, 2008, 03:32 PM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by samjudson
 With .Net there is no guarenteed way to completely hide your source code. There are a few things you can do to stop people changing it however.

1) Obfuscate your code. Visual Studio comes with a simple .Net Obfuscator but other commercial products are available. This makes your source code very hard or impossible to understand.
2) Add an assembly key and strong sign your DLL. This means no-one could simply rerelease you DLL as their own without the private key.
3) Add a digital signature to your DLL. This would add the benefit of identifying you as owner of the code. Again, it couldn't be changed or altered without removing this.

/- Sam Judson : Wrox Technical Editor -/
thanx,
where can i find good articles about option2 and 3 ?
 
Old March 28th, 2008, 03:42 PM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 If you are wanting to publish the source code itself then you aren't going to be able to "lock" it. If a user could read it they could always just copy/paste or re-type it to reproduce it. About the only thing you could do is make it more difficult for them to copy it. For example you could publish it as an image instead of as text. Then they'd be forced to reproduce it visually.

-Peter
peterlanoie.blog
nice,
but when you right click of some code in dot.net,
for example, see flowing code:
int a =10;
when you right click on word "int" and select "Go to defenition" you will be forewarded to a page that show some code of Int32 structure..
when you click on that page bye mouse, you will be get a message that shows you a message like this:
"cann't currentyli modify this text on the editor, it is read only "
but you can see some code like :

public const int MaxValue = 2147483647;
public const int MinValue = -2147483648;
public int CompareTo(int value);

and so on.
i want to creat a page like this.
it's not important for me which user can copy my code.
i want, user cann't be able to modify my code

thanx
regards
 
Old March 28th, 2008, 04:03 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

That is purely a function of Visual Studio. It's showing you "code" from the assembly metadata. It is showing this to you in its own viewer.

If you distribute an assembly and protect it as suggested earlier, when someone consumes your assembly they'll likely see a similar view of metadata and it will be non-editable.

-Peter
peterlanoie.blog
 
Old March 28th, 2008, 04:08 PM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 That is purely a function of Visual Studio. It's showing you "code" from the assembly metadata. It is showing this to you in its own viewer.

If you distribute an assembly and protect it as suggested earlier, when someone consumes your assembly they'll likely see a similar view of metadata and it will be non-editable.

-Peter
peterlanoie.blog
Ok,
thanx peter for your verry fast reply
can you help me about option 2 and 3 on post 3 ?
regards
 
Old March 30th, 2008, 12:06 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Sorry, I have done neither. But you should be able to find ample examples online that describe either process.

-Peter
peterlanoie.blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock carumuga SQL Server 2000 1 June 18th, 2008 03:07 PM
folder lock !!!!!!!!!!!!!! angelboy C# 2005 0 February 11th, 2007 12:39 PM
lock the screen darthziv Pro VB.NET 2002/2003 0 December 4th, 2005 03:59 AM
How do i lock ? abdusalam SQL Server 2000 1 September 28th, 2004 03:26 AM
i need to lock a row in table alyeng2000 SQL Server 2000 6 May 17th, 2004 09:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.