Solved

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

Posted on 2009-05-14
1
180 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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 Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

785 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