Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Debug mode path is not from root

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 02 Aug 2007 22:51 GMT
When I go into debug mode and the web page I am working on opens in the
browser via the local Cassini Web Server I get a path appended onto the full
path e.g.

localhost:7859/FolderName/filename_that_should_be_in_the_root.aspx

this is a pain as I do my links from the root e.g. /css/site.css and the
additional folder in the path stops that. Is there any way to get the site
in debug mode to show

localhost:7859/filename_that_should_be_in_the_root.aspx

Regards, Chris.
Jesse Houwing - 02 Aug 2007 23:08 GMT
Hello Chris,

> When I go into debug mode and the web page I am working on opens in
> the browser via the local Cassini Web Server I get a path appended
[quoted text clipped - 9 lines]
>
> Regards, Chris.

Because you'll never know the deployment url might change you need to write
your code agnostig of the deployment location.

If you have urls in controls (NavigateToUrl, PostBackUrl, ImageUrl etc) you
can use the ~/ notation to specify the application root.

The same goes for certain urls in the head section of a website (stylesheet
links are among those I believe).

You can also put your css files in a theme (put them in a folder called App_Themes\ThemeName)
and set the theme in the Pages tag of the web.config. All pages will automatically
load all css files in the specified themes directory. Should you ever need
to change the look & feel of the pages you can just change teh contents of
the theme directory and all pages will automatically load then new stylesheets.

Jess
Chris - 03 Aug 2007 00:44 GMT
This is what I am doing. Say my website project sits in a folder called
MyProject and I have a css file in a folder css/mystyles.css

I would put the link as href="/css/mystyles.css"

However when I press F5 and go into debug mode the root from the localhost
becomes

localhost:7859/MyProject/css/mystyles.css

which makes my link stop work when in debug mode. It's fine on the live
server. Is there some setting somewhere as it seems so easy to break any
pathing from the root.

Regards, Chris.

> Hello Chris,
>
[quoted text clipped - 29 lines]
>
> Jesse
Jesse Houwing - 03 Aug 2007 11:45 GMT
Hello Chris,

> This is what I am doing. Say my website project sits in a folder
> called MyProject and I have a css file in a folder css/mystyles.css
[quoted text clipped - 9 lines]
> live server. Is there some setting somewhere as it seems so easy to
> break any pathing from the root.

Did you have a look at the project properties sheet called "Debug" it allows
you to set such details. But appart from that. Have you tried settign teh
path to your CSS file to

~/css/mystyles.css

This should expand the path to the correct oen each and every time, regardless
of where you're going to deploy it. (You might need to add runat="server"
to the <head> tag to make this work.

You could also try the Themes feature I pointed you to earlier.

It's better to cure the desease than to treat it's symptom in my opinion.

Jesse

> Regards, Chris.
>
[quoted text clipped - 32 lines]
>>
>> Jesse

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.