Welcome to WebmasterWorld Guest from 107.23.176.162

Forum Moderators: ocean10000

Message Too Old, No Replies

Unable to find code-behind files

     
8:12 pm on Jun 21, 2010 (gmt 0)

New User

10+ Year Member

joined:Jan 3, 2007
posts: 22
votes: 0


I am just beginning to work with ASP.Net (which is probably obvious from my question), but I haven't found an answer in my searches.

I am working with some code which someone else created (I would ask him this question if we knew how to contact him). The code works fine, but I need to make some changes and I'm not able to locate the code-behind files. They are not in the folder with the aspx files, but they must be somewhere because everything is working. They would be C# files if that makes any difference. Where should I be looking for them?

Thanks in advance for the help.
9:30 pm on June 21, 2010 (gmt 0)

New User

10+ Year Member

joined:May 17, 2006
posts: 24
votes: 0


Well, he might have precompiled the website in which case the .cs files would be gone, and compiled into an assembly (.dll) named after the project in the /bin folder.

To get to the actual code, you can use a tool such as reflector.net from Red-Gate. The code you get from this tool is somewhat hard to read as all variable names are garbled, but you should be able to reconstruct the original code with some effort.

Background info: The first time a .net website is run, the webserver compiles all codebehind-files into a .dll-file which it places in the /bin folder. This causes considerable delay on the request which triggers the compilation (the first). To prevent this, you can choose to precompile your project, essentially doing what the server would have done on the first request, thus having optimal speed from the get-go.

Hope this helps.
-Peter
5:57 pm on June 22, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 4, 2009
posts:186
votes: 0


Look in your .ASPX file, the very first line and you may have something like this line:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" CodeFile="codebehind/contact.aspx.cs" Inherits="_Default" %>


In this case, this tells me that the code-behind is in a folder called "codebehind" and is named contact.aspx.cs"

If you dont have that, as was previously mentioned, your file may have been converted into a DLL.
7:00 pm on June 22, 2010 (gmt 0)

New User

10+ Year Member

joined:Jan 3, 2007
posts:22
votes: 0


The code was compiled and I'm using Reflector to figure it out. I think I'm heading in the right direction now.
Thanks so much!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members