Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I access the code behind an existing page?

Status
Not open for further replies.

roblasch

Programmer
Dec 30, 2000
168
US
I am new to asp.net and am trying to edit the design of some existing asp.net pages. I have access to the server through ftp or remotetly, but I cannot find the actual code that runs the pages. Is it because it has been compiled? If so, can I get to it? I have web matrix installed.
 
What do you mean by the "actual code that runs the pages"? Yes, the application does need to be compiled, and the .dll runs. But this won't do you an good, this is not and editable file.
If you want the code behind file, you need to look for a page with an extention of
yourpage.aspx.vb OR
yourpage.aspx.cs OR
yourpage.aspx.js OR
depending on the language you are using
 
I have looked for that file and cannot find it. The aspx files make a reference to it ... codeBehind=store.aspx.cs . But when i do a search, that file doesn't show up.
 
Talk to the previous developer if you can, or someone who knows about the project. By default the files are created in the same folder. Why they would be moved somewhere else is beyond me.
 
I searched the entire computer and can't find the files. Can the page work without them? If it is compiled. I don't have access to the previous developer.
 
You can run the project, if it has been compiled. However, if you need to change any pages, you will need to find the files.
 
When you create the web project the .vb or .cs code behind pages are created, however when you deploy the project (probably to your production web server) during the 'Project Copy' process there is a checkbox that states only to copy the files that are needed to run the page (for security and space issues). This option excludes the code-behind pages (you probably don't see the solution or a project file either right?). You need to find where the files were actually created. Most of the time they are located in the My Documents\Visual Studio Project folder on your local machine. I agree with jbenson, talking with the programmer would be helpful.
 
So, despite the line at the top of the aspx page (on the server) '<%@ Page language="c#" Codebehind="shipping.aspx.cs" AutoEventWireup="false" Inherits="testNET.Store.ShippingForm" %>' the cs file is not neccessary for the page to run on the server? So my next question is this. I am simply changing the look of the page, not the functionality. If I use the same tags for all of the form elements and at the top of the page, etc., and save the pages as they are now named, will everything still work?
 
Should do as long as you don't add or remove any server controls, and in the code behind and don't need to change any server side functionality.

This is also dependant on whether any of the 'look' of the page is controlled by the server side code which of course you can't do anything about.

Basically you can play with the client side elements of an ASPX page without recompiling or changing the codebehind.

Rhys
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense Edsgar Dijkstra
If life were fair, Dan Quayle would be making a living asking 'Do you want fries with that?' John Cleese
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top