Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0CanCan't figure out relative path to work.
Previous
 
Next
New Post
8/10/2007 4:15 PM
 

True, but my problem is with a different side of this issue, let me explain a little better:

I have a need to reference an external JS file for my module. The file resides in root/js/Tabs/ folder. To reference that file, I add the following tag < script src="/js/Tabs/tabs2.js" /> the ascx file. It works well for a site with a simple domain name, i.e. http://www.mysite.com/ - as that relative path will translate to http://www.mysite.com/js/Tabs/tabs2.js and correctly point to the file.

HOWEVER! If the site's domain is something like http://www.mysite.com/clientssiteindev, it translates ALSO to http://www.mysite.com/js/Tabs/tabs2.js which is no longer good as http://www.mysite.com/ does not necessarily point to that root directory. The better example is a development scenario in VS 2005 - it creates a path like http://locahost:1651/Website - so http://locahost:1651/js/Tabs/tabs2.js just doesn't exist

I've tried several different techniques to just insert the full path at run time by adding domain name in from of the relative path... to no avail...

Any ideas?


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
8/10/2007 4:43 PM
 

aah yes....good point.

Try this

../../js/Tabs/

Your code will always be in the desktopModules/ModuleName folder, that should back you out two directories and get it to work

Otherwise you will need to use Server.MapPath() to build the path.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
8/10/2007 4:55 PM
 

I'd recommend adding the javascript in your modules code-behind via the clientscriptmanager (http://msdn2.microsoft.com/en-us/library/system.web.ui.clientscriptmanager_members.aspx ). As it's server code, you can use the tilde "~" to calculate paths, this will correct build up a path irrespective of whether a site is a parent or a virtual e.g. http://msdn2.microsoft.com/en-us/library/kx145dw2.aspx


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
8/13/2007 12:16 PM
 

@Mitchel

Seems to be that way, but actually, the relative paths inside modules resolve to whatever it is from Default.aspx in root directory. At least, it seems that way. So when I referenced that javascript file like this: src="js/tabs/thefileineed.js" it finally worked on both types of domains.


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
New Post
8/13/2007 12:19 PM
 

@cathal

I agree with you. It just seemed to be such a simple thing to do without getting code involved... :)


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0CanCan't figure out relative path to work.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out