Solved

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

Posted on 2009-05-14
1
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

724 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