website in DLL, need to access the code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I am taking over someone else's code and my users are experiencing tons of
problems but when I try to go into the source code to edit and try to fix
these problems, I realize that all the old programmer's code is in DLLs so I
cannot access the source from anywhere. It's really becoming a problem.
So..my question is twofold, is there a way to extract the code from the DLL
(probably not), if not, what are some other options I have????

Visual Studio 2005
Asp.net 2.0
C#

Thank you, Karina
 
Generally one builds a .dll from code (it is also quite common to only
deploy a .dll for varying reasons)... do you not have the source?

You could do something along the lines of using reflector to reverse
engineer the dll (there is a plugin the generate files) but you would be
missing alot of important information such as comments etc.

The best option would be to get the source code.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
 
Hello Greg,

The old programmer left and he deleted the source code and left the DLLs.
Getting the source code, unfortunately is NOT an option.

What is "reflector"? Where can I get more information on that option?

Thank YOU, Karina
 
Thank you Greg. I will try this tomorrow and let you know the results.

Thakns again, Karina
 
Greg,

Thank you for the help. I downloaded the DLL and the reflector program. I
am not sure what to do with the DLL where do I put it? Sorry I am quite new
to Asp.net and C#.
Thank YOU,
Karina
 
That program is a decompiler ... The plugin allows it to create file
representing your .dll.

First run reflector ... then go to tools->add ins .. click add and browse to
the other .dll.

After doing this you will have a new item in the tools menu (File
Disaassembler). You can use this to disassemble the .dll to a set of files.

Cheers,

Greg
 
Run reflector; View -> Add-Ins... -> Add...

Drag you web-site dll into reflector; select it;

Tools -> File Disassembler

Good luck (and note: don't expect any comments etc... and pray it isn't
highly obfuscated)

Marc
 
Thank you all! That worked great, I was able to see the source code of
genLog.cs, I changed what was wrong (a static IP address, we moved servers
and it was hard coded in the dll file). Now I must re-DLL the file. I tried
using csc.exe but it tried to make an EXE and not a DLL plus it gave an error
about missing a main in the .cs file.

How do I get it back to a DLL. When I un-DLLed the file, there were 3 files
in total, a CS file, a proj file and a assemblyInfo.cs file. There is
another small issue. The project was written in asp1.1 so when I try to open
it in visual studio 2005, it asks to convert, the site is in 1.1 so I cannot
convert as it might break something else.

I talked to my manager about getting some kind of procedure so that this
does not happen again.

Thank you again for all the help, I am still learning.
Karina
 
To get it back you would have to put the code into a project and compile it.
Since it is 1.x you would need to do this in 1.x. You can also build from
the command line (csc or nant etc).

Cheers,

Greg
 
Greg,

I want to use the command-line compiler so I did this:

C:\>cd c:\WINDOWS\Microsoft.NET\framework\v1.1.4322

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322>csc
c:\empAdmin\bin\genLog.aspx_Sou
rce\genLog.cs

and recieved this error:

error CS5001: Program
'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\genLog.exe'
does not have an entry point defined

I am using the 1.1 compiler instead of the 2.0 but when I use the 2.0 i
basically get the same error.

Thank you for any help you can provide, Karina
 
Add /target:library to csc ... by default it will try to compile as a
windows .exe which requires a Main() entry point.

Cheers,

Greg Young
 
Greg,

Thanks again, that worked like a charm but I got a tough one for you but I
have faith you'll know a solution.

Again, I am not very familiar with the entire c#/class/DLL structure but
here is what the broken site has:

a bin folder with "genLog.aspx.DLL" in it

an employment folder that has the html for the application that's breaking

and a "genLog" folder that contains the genLog.aspx file (that uses that
bin/genLog.aspx.DLL file).

When I un-DLLed the DLL file, it gave me 3 files including a genLog.cs so
when I re-DLL-ed it, it named it genLog.dll instead of
genLog.aspx.dll........So when I run the application in the web browser I get
this error:

Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: The located assembly's manifest definition with name
'genLog.aspx' does not match the assembly reference.

Source Error:
Line 256: <add assembly="System.EnterpriseServices,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257: <add assembly="System.Web.Mobile,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258: <add assembly="*"/>
Line 259: </assemblies>
Line 260:

Source File:
c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config Line:
258

Assembly Load Trace: The following information can be helpful to determine
why the assembly 'genLog.aspx' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = genLog.aspx
(Partial)
LOG: Appbase = file:///E:/Inetpub/oprs/web
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).
LOG: Post-policy reference: genLog.aspx
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/945bae20/d6dbc064/genLog.aspx.DLL.
LOG: Attempting download of new URL
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
Files/root/945bae20/d6dbc064/genLog.aspx/genLog.aspx.DLL.
LOG: Attempting download of new URL
file:///E:/Inetpub/oprs/web/bin/genLog.aspx.DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME

It says something like NAME mismatch....i'm assuming it's the name of the
DLL. I changed it manually (just 'rename') but of course that didn't work.

Any sugestions? Solutions? Thank you again

Karina
 
Back
Top