Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
.NET Framework GroupsView
.NET Distributed_Apps
.NET
.NET ADO.NET
.NET ASP.NET
.NET ASP.NET Security
.NET ASP.NET Webcontrols
.NET ASP.NET Web Services
.NET Clr
.NET Compact Framework
.NET Drawing
.NET Interop
.NET Performance
.NET Web Services
.NET Windows Forms
.NET Windows Forms Controls
.NET General
.NET Csharp
.NET Visual Basic
.NET Vc
.NET Security
.NET Xml
Vsnet Debugging
Xml
Xsl
Scripting Jscript
Scripting Visual Basicscript
Scripting Wsh
Smartphone Developer
Visual Basic Com
Visual Basic Controls
Visual Basic Crystal
Visual Basic Database Ado
Visual Basic Syntax
Visual Basic Winapi
Vc Atl
Vc Debugger
Vc Language
Vc Mfc
Vc Stl
Visio Developer Visual Basica
Windowsce Embedded Vc
Windows Powershell
Visual Basic Vista Compatibility
Deployment Server
.NET Micro Porting

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Apps
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft NET ASP NET Posts  Ask A New Question 

path reference issue with a single masterpage and subfolders on a

markm7 posted on Tuesday, May 06, 2008 12:52 PM

There is probably some simple answer to my question, but i'm still new to
this a bit..

I have a master page.. with a menu system which is coded onto the
masterpage.aspx... it uses A tags with hrefs etc.. the usual stuff..

I also have a sub section on the site.. where aspx files arent in the
root.. ie:   /rootfiles.aspx here.. then /subsection/subfiles.aspx

The menu is fine and dandy with the usual relative references like <a
href="default.aspx" > for the root page.. but when you are say
/subsection/subfiles.aspx all the menu items paths are incorrect.

So at this point i figure i have two or 3 choices.. I could one, make a
seperate masterpage in the subsection (not desired).. or.. I can just do a
search in the request.path variable for the word "subsection" and if it
exists, then dynamically change all the menu items href paths to the correct
format.. ie:  if in a subsection, href becomes ./default.aspx for the root
page..

In doing this second option, it seems i have to do the same thing on the
masterpage.aspx.. as there is a  reference in there and
this cant be changed, only on the aspx file itself (ie:  i cant reference it
in codebehind in the page load event).

Any thoughts on this?  If these options are the best ones.. would it be a
bad idea to make all the menu links runat="server", so that i can access the
href property from the page load event and set all the values in that
procedure.. or would i be just as good to do all the checks in the embedded
c# code in the aspx page itself.. albeit a bit more messy but all client side?

Thanks
reply

 

For server side controls, you could also use a path such as ~/mydir/myfile.

Patrice posted on Tuesday, May 06, 2008 1:09 PM

For server side controls, you could also use a path such as
~/mydir/myfile.aspx (note the leading ~ symbol) to create application root
relative URLs...

Try http://msdn2.microsoft.com/en-us/library/ms178116.aspx  for details...


--
Patrice


groupe de discussion : B3AF55B9-3992-438D-953F-48F02B93FD9E@microsoft.com...
reply


Previous Microsoft NET ASP NET conversation.