Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Path to root
masseyf
#1 Posted : Friday, October 28, 2011 8:26:14 AM(UTC)
Groups: Member
Joined: 10/28/2011(UTC)
Posts: 12
Location: Montreal

Was thanked: 3 time(s) in 3 post(s)
Hi!

I have an issue with paths when using UWS. My application my originally designed to work under Cassini and it ran great. But now under UWS, paths that used to work fine are invalid.

I’m hosting the application under a virtual folder named “ACD80”. For example I have a help link in a master page that exists in the root folder. The page that is constructed from that master page exists in the “auth” folder under the root. The help page is located in the “help” folder under the root folder.

Here's the structure of the source folders:

Root (ACD80)
---- master page containing the link to help html file
---- Auth folder
---- ---- Page that gets constructed from the master page
---- Help folder
---- ----- HTML help file

I can’t find a way to specify that the help link should be relative to the root (ACD80). Here are coding examples and their results:

If the help path is coded as “/Help/TopicSections.html” in the aspx master page, it resolves to “http://localhost:9993/Help/TopicSections.html” which is wrong. ASP.Net specifications specifies that a path starting with “/” should translate to a location under the Web site root, which is not the case, unless I misinterpret what root means. My web site root in this case should be its virtual directory ACD80. So I don’t understand why I would get a path that does not include my virtual directoy.

If the help path is coded as “Help/TopicSections.html” then it is resolved to “http://localhost:9993/ACD80/auth/Help/TopicSections.html” which is correctly coded as far as ASP.NET goes but wrong for the application because the help folder is directly in the root, not under the “auth”.

“~” will not work (it’s not a server-side control) so I assume that’s normal.

The last thing I want to do is start hard coding paths (like “../help/page.html”) in the master page since the master page could be used from sub-sub folders, or from a page in the root. It would defeat the purpose of master pages. So I’m confused about what to do next.

Is there a way to specify that a path should be relative to the root?

Thanks you!
Ultidev Team
#2 Posted : Friday, October 28, 2011 8:43:48 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi there!

It appears that it's not a UWS-specific problem. We are pretty sure if you run your application under IIS, you'll have same problem. If we understand you correctly, all the incorrect links you get are limited to the master page. If so, then all links on the master page should use "~/" paths (as child pages can be at different levels), and either be Hyperlink controls, or (better) regular HTML hyperlinks with "runat=server" attribute - which makes them work fine with "href='~/blah'".

Please let us know if this information was helpful.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
masseyf
#3 Posted : Friday, October 28, 2011 9:09:34 AM(UTC)
Groups: Member
Joined: 10/28/2011(UTC)
Posts: 12
Location: Montreal

Was thanked: 3 time(s) in 3 post(s)
Hi!

Indeed, if I use runat with ~ it provides the right path. So that's good!

I do have a similar issue with link and javascript files. In the master page I have to hard code the path to the javascript link as this:

<script src="../js/utils.js" type="text/javascript"></script> (note the ../)

If coded as

<script src="~/js/utils.js" type="text/javascript"></script>
or
<script src="/js/utils.js" type="text/javascript"></script>
or
<script src="js/utils.js" type="text/javascript"></script>

the script is not recognized. Again that used to work under Cassini but not under UWS. Would there be a similar solution?


Ultidev Team
#4 Posted : Friday, October 28, 2011 10:30:11 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi!

The solution is exactly the same: server side UI markup, ASPX pages, master page, customer controls, etc. - all of them can have any tag, including <script> to have "runat='server'" and "src='/~'". Since this issue is not UWS-specific, but rather just an ASP.NET programming technique, you may find more information at appropriate ASP.NET internet resources.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.