Solved

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

Posted on 2009-05-14
1
178 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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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