Solved

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

Posted on 2009-05-14
1
179 Views
Last Modified: 2012-06-22
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
Comment
Question by:lapucca
1 Comment
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24485925
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now