|
How can i lock (or encode) my dll file in C# so that cant be decode by reflector or ect.
|
|
|
|
|
You can use one of the various Obfuscators that are available.
However, none of these are absolutely fool proof so there is always a way someone can decode the dll.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
You can't. If you could, how would the CPU know what to do?
You can obfuscate it all you want, but it will never be such that it can't be decoded - not and still be runnable by the computer.
|
|
|
|
|
jojoba2011 wrote: How can i lock (or encode) my dll file in C# so that cant be decode by reflector or ect.
1. Write you code.
2. Compile it to create the dll.
3. Write a server that handles TCP requests by giving them to your dll (step 2.)
4. Write a proxy that sends requests via TCP to your server (step 3.)
5. Set your server up in a secure hosting environment with the correct security policies in place.
6. Distribute the proxy and only the proxy to other people.
|
|
|
|
|
+5; the only way of securing your code is by having it run in a secure environment, merely communicating with the outside world.
MacAfee proved that
Bastard Programmer from Hell
|
|
|
|
|
Hi there!
I have an exception in my senderemail program.
here the code:
private void SendEmail(MailMessage message, MailAddress from)
{
message.Subject = txtTitle.Text;
message.SubjectEncoding = Encoding.UTF8;
message.BodyEncoding = Encoding.UTF8;
SmtpClient smtpClient = new SmtpClient(Properties.Settings.Default.SMTPServer);
smtpClient.EnableSsl = false;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential();
try
{
smtpClient.Send(message);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
message.Dispose();
}
}
but in line "smtpClient.Send(message);" I have the following exception :
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 74.112.253.35:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at EmailSender.EmailSenderForm.SendEmail(MailMessage message, MailAddress from) in
how can I solve it?
|
|
|
|
|
1) check you can ping the mail server's ip address from your computer.
2) use telnet to connect to the ip and port to see if there is an email server there.
*) try removing the ":25" from the address you are specifying.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
|
|
|
|
|
I am using ControlPaint.DrawReversibleFrame to draw a frame while the user clicks/drags on a control. All is well there. Once complete, I do some things with the information, including drawing to the control using rectangle used to draw the frame. However, if I drag backward OR upward, I end up with nothing because it has negative values. How can I correct this? Sorry if I did not explain well enough, I am busy with things at home. But I can elaborate later if necessary.
SOLUTION:
Basic math
if (finalRect.Width < 0)
{
finalRect.X = (finalRect.X + finalRect.Width);
finalRect.Width = Math.Abs(finalRect.Width);
}
if (finalRect.Height < 0)
{
finalRect.Y = (finalRect.Y + finalRect.Height);
finalRect.Height = Math.Abs(finalRect.Height);
}
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
modified on Friday, September 2, 2011 8:54 PM
|
|
|
|
|
i am trying to make the following web code work for a C#.net 2008 desktop application. My company wants us to use the same logic to check groups in the active directory. The following is the code snippet I obtained from the contract.
From the contractor, i also obtained the xml file. The three columns i am referring to are not in the xml file. The fields I am trying to figure out how they are referenced in the app code are the following:
DirectoryEntry
DirectorySearcher
SearchResult.
Would you have any idea what I can use to point to the columns listed above are that I can use in a C#.net 2008 desktop application? if so, can you show me some code and/or point to a url that I can use as a reference?
The following is the code i am trying to work with:i am trying to make the following web code work for a C#.net 2008 desktop application. My company wants us to use the same logic to check groups in the active directory. The following is the code snippet I obtained from the contract.
From the contractor, i also obtained the xml file. The three columns i am referring to are not in the xml file. The fields I am trying to figure out how they are referenced in the app code are the following:
DirectoryEntry
DirectorySearcher
SearchResult.
Would you have any idea what I can use to point to the columns listed above are that I can use in a C#.net 2008 desktop application? if so, can you show me some code and/or point to a url that I can use as a reference?
The following is the code i am trying to work with:
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
namespace Sup
{
public class ActiveDirectoryValidator
{
private string _path;
private string _filterAttribute;
public ActiveDirectoryValidator(string path)
{
_path = path;
}
public bool IsAuthenticated(string domainName, string userName, string password)
{
string domainAndUsername = domainName + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, password);
try
{
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + userName + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
_path = result.Path;
_filterAttribute = (String)result.Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return true;
}
}
}
|
|
|
|
|
|
In the code listed below, is there a way to call the
IsAuthenticated
mehtod without using a password? I do not want to obtain a password for the user since i do not need it for windows authneication and the code is more secure.
public bool IsAuthenticated(string domainName, string userName, string password)
|
|
|
|
|
|
it has been like that the whole week long; people should stop replying till he finally gets it.
|
|
|
|
|
Luc Pattyn wrote: it has been like that the whole week long
I did not know that. I tried to answer the question in all earnest.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
I want to mention the following:
1. Sorry1 If i am formatting the statements incorrectly, can you point me to directions o0n how to format the comments and how to format the code? it looks like the last time I formatted a question, it was formatted exactly like the code block?
How do you format the code separate from comments (statements)?
2. The directory services name space works very well. however the code wants a ldap path. Is that something from code i can find or do I need to find out this ldap path from the network administrator?
|
|
|
|
|
dcof wrote: 1. Sorry1 If i am formatting the statements incorrectly, can you point me to directions o0n how to format the comments and how to format the code? it looks like the last time I formatted a question, it was formatted exactly like the code block?
You can always edit your question even now and format it within pre tags.
dcof wrote: 2. The directory services name space works very well. however the code wants a ldap path. Is that something from code i can find or do I need to find out this ldap path from the network administrator?
Do you mean the Active Directory Server? This thread[^] talks about a solution. But it uses COM within it.
I don't know if there is a managed way.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
Apparently I am not formatting my post correct. Can you point me to a url where the post is formatted ok? How do you get the comments separated from the code?
|
|
|
|
|
You put the code inside the "pre" tags, and you put your comments outside the "pre" tags.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I will do that from now on.
You put the code inside the "pre" tags, and you put your comments outside the "pre" tags.
Is this post ok?
|
|
|
|
|
Easy:
This is text - it has no formatting.
This is a code block
It starts with a <pre> tag, and ends with a closing </pre> tag.
You can hold your mouse over the word "code" just above the textbox where you type your message, and it will provide you with a list of the "known" code block types.
When you paste, on the right hand side of your screen is a popup with options for the paste - if you are pasting text and code, then select 'HTML "as is"' and it will be pasted unformatted. You can then apply appropriate formatting to just the relevant sections.
The advantage is that the formatting preserves indentation, and visually separates the code from the problem description - makes it easier for us all to read!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Thank you for showing me how to format the statements!
|
|
|
|
|
|
|
Most questions on these forums are well formatted, here[^] is a short example, and here[^] a longer one. All easy to read and hence getting more, earlier and better replies.
BTW: For more information on CodeProject's PRE tags, I wrote this tip[^].
|
|
|
|
|