Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

How can I specify file location in an asp web page code?

Hi, I'm using vs2008 and .net 3.5.  I opened up an existing asp.net page done by other programmer.  I have a site.master file where it specify the CodeBehine-"Site.master.cs". Now, I download these files from a FTP site and save them to my hard drive in my own and newly created folder.  
How can I specifiy to find the cs file in the same directory as the site.Master file that I currently have opened?
Also, in antoher About.aspx file, it referrs to the Site.master file but the path doesn't work.  What's the best way to define the path?  The about.aspx locates at c:\projects\Views\Home.  The Site.Master file locates at c:\proejcts\Views\Shared.  I tried specifying as "../Shared/Site.Master" but that doesn't work.  
thanks.
0
lapucca
Asked:
lapucca
1 Solution
 
abelCommented:
The master must be in the same project as the aspx files. They may be in another directory. To specify, use the tilde-syntax: "~/MyProjRoot/Masters/mymaster.master".

On the part where you have taken some master files from elsewhere: microsoft automatically creates a designer.cs file and automatically adds certain references. Also, the names of the namespaces are important and will be different for your own project then for the one you downloaded.

To do this easily, add a new masterpage. Open the Master.cs (will be almost empty). Now you paste the code that is inside the partial class of the downloaded master to the same location in this file. Be aware of the accolades.

The same for the Site.Master file. You copy the part of the downloaded file that is between the <html> and </html> and paste it on the same location of your new master file. The files may have the same names, as long as you keep your downloaded file outside your project (i.e.: it should not be part of the build process), instead, the newly created one should, which is now containing the same contents as the downloaded file.

-- Abel --
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now