Modifying a compile asp.net assembly when no longer have source#

So while I was at the MVP Summit, an old client got a hold of me and said there was a weird error on the site when a user was trying to post something.  He sent me a screenshot and it said could not login as sa to sql server.  I remoted into the server where they had moved the application and looked in the web.config file and did not see any connection string that had sa as the user name.  So I was stumped.  I began to look at the stack trace and realized which assembly this was coming from.  This happened to be the only assembly which did not have the source code on the server.  I wrote the app over 6 years ago and the laptop the source was on had recently had a failed hard drive.

Anyway, it was a vb.net 1.1 app from visual studio 2003.  Yes I used to do a little VB. :)  So I realized that there must have been a connection string hard coded in the assembly where the stack trace was coming from.  Oh no!  How was i going to fix this without changing the sa password on their new host which was not really an option? 

First thing I did was download reflector here. I opened the assembly and did see the hard code connection string.  Man what an idiot for doing that.  Don’t know why I did that at the time, but not a very smart move. So I was stuck.  How do I edit an assembly without having to export all the code from reflector, find visual studio 2003 and run it in a virtual, download the rest of the app and pray that I could get it to work.  Well i searched for modifying a .net assembly and found this: Reflexil - http://sebastien.lebreton.free.fr/reflexil/ . It is a plug-in that works inside of reflector that allows the modification of the code in the assembly.  So i downloaded it opened the assembly, changed the connection string code and then saved it.  The .dll ended up being a third the size, but still worked after deploying it to the server.  I was shocked.  I just had edited a vb.net 1.1 assembly on a windows 7 laptop using reflector while in a session during the MVP summit.  Pretty cool I think.  Saved me a whole day of figuring out how to run visual studio 2003 and get that code compiled again.

Wednesday, March 25, 2009 7:42:51 AM UTC #    Comments [3]  |  Trackback Tracked by:
"Baby names search - Search for zimmerman" (Baby-Parenting.com) [Trackback]

 

Saturday, March 20, 2010 6:24:44 PM UTC
According to my own investigation, thousands of people on our planet receive the loan from different banks. Hence, there is good possibilities to get a financial loan in any country.
Saturday, May 15, 2010 2:57:22 AM UTC
People are frequently think of about the fine old days. I reply, why don't you pronounce the good nowadays? I’ve have a lot of free time with research paper aid, and can do anything what I like!
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, i, strong, u)  

Enter the code shown (prevents robots):

 

All content © 2010, Jim Zimmerman
Book
New Book
Links to me
On this page
Sponsors
Calendar
<March 2009>
SunMonTueWedThuFriSat
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234
Archives
Tags
Blogroll OPML
Technorati
Favorite Links
Disclaimer

Powered by: newtelligence dasBlog 1.9.6264.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail