I just want my root
-
Good day all who read. I'm having some problems with including some Javascript files. I have recently restructured my website so that all the pages site in seperate folders dependant on which section they are part of. I am using the ~ attribute all over the place to reference other pages and images etc. This all works fine. In my masterpage I want to include some Javascript external files but I can't use the ~ tag as this ruins the script tag. Therefore I am using the following in Page_Load
Page.ClientScript.RegisterClientScriptInclude("MAD", Request.Url.ToString().Replace(Request.Path, String.Empty) + "/Javascript/MAD.js")
Someone suggested this and as much as it does work locally it doesn't on the webserver. This is because the site lie in a sub directory. This code drops the subdirectory. Therefore I am looking for the code that can traverse and output the domain (www.thesite.com), any ports that may be used (thanks to local versions with virtual server), and any sub domains that the app may be running in ( /Testapp ). I have tried Server.Mappath but this doesn't seem to include the file correctly. Also I don't want a local path in the page's outputted code. Thanks