Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Debug mode path is not from root

Reply
Thread Tools

Debug mode path is not from root

 
 
Chris
Guest
Posts: n/a
 
      08-02-2007
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.


 
Reply With Quote
 
 
 
 
Jesse Houwing
Guest
Posts: n/a
 
      08-02-2007
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
> 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.
>


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


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      08-02-2007
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.

"Jesse Houwing" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> 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
>> 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.
>>

>
> 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.
>
> Jesse
>
>



 
Reply With Quote
 
Jesse Houwing
Guest
Posts: n/a
 
      08-03-2007
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
>
> 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.


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.
>
> "Jesse Houwing" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) m...
>
>> 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
>>> 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.
>>>

>> 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.
>>
>> Jesse
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
netvmini.sys still not working on Windows 7 even after driver signing disabled ?! (Windows debug mode necessary for debug drivers ???) Skybuck Flying Windows 64bit 3 08-09-2009 05:54 AM
User Control access fails in debug mode, works in release mode rbg ASP .Net 0 01-17-2007 10:51 PM
Response.Redirect is slooow in debug mode, ok in release mode =?Utf-8?B?TWF4?= ASP .Net 0 02-11-2006 12:37 AM
Debug mode dll's vs release mode dll's? Dave ASP .Net 0 02-20-2004 03:49 AM



Advertisments