Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Relative path Problem

Relative path Problem

Scheduled Pinned Locked Moved ASP.NET
javascriptjavacsstoolshelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dipak dipak
    wrote on last edited by
    #1

    Hello, I have a master page in my project and in master page i have defined all external links on header for javascript files and css files. And all .aspx pages (including sub folder pages) are under that single master page. all these are running Properly for .aspx page located in the root and not working properly for sub folder pages, when i am setting path like: And Not running Properly for .aspx page located in the root and Working Properly for subfolder pages, when i am setting path like: <script language="javascript" type="text/javascript" src="../scripts/myScript.js"> And link like src="~/scripts/myScript.js" not working for any one. Please give me suggestion how can i define external java script path to work properly from all (root / sub folder) files.. I will be very thankful to you... :-O <div class="ForumSig">Dipak </div>

    A D A 3 Replies Last reply
    0
    • D dipak dipak

      Hello, I have a master page in my project and in master page i have defined all external links on header for javascript files and css files. And all .aspx pages (including sub folder pages) are under that single master page. all these are running Properly for .aspx page located in the root and not working properly for sub folder pages, when i am setting path like: And Not running Properly for .aspx page located in the root and Working Properly for subfolder pages, when i am setting path like: <script language="javascript" type="text/javascript" src="../scripts/myScript.js"> And link like src="~/scripts/myScript.js" not working for any one. Please give me suggestion how can i define external java script path to work properly from all (root / sub folder) files.. I will be very thankful to you... :-O <div class="ForumSig">Dipak </div>

      A Offline
      A Offline
      Arun Jacob
      wrote on last edited by
      #2

      Use this in the Code behind

      ClientScript.RegisterClientScriptInclude("ScriptFile", ResolveClientUrl("~/JScript.js"));

      Arun J

      D 1 Reply Last reply
      0
      • D dipak dipak

        Hello, I have a master page in my project and in master page i have defined all external links on header for javascript files and css files. And all .aspx pages (including sub folder pages) are under that single master page. all these are running Properly for .aspx page located in the root and not working properly for sub folder pages, when i am setting path like: And Not running Properly for .aspx page located in the root and Working Properly for subfolder pages, when i am setting path like: <script language="javascript" type="text/javascript" src="../scripts/myScript.js"> And link like src="~/scripts/myScript.js" not working for any one. Please give me suggestion how can i define external java script path to work properly from all (root / sub folder) files.. I will be very thankful to you... :-O <div class="ForumSig">Dipak </div>

        D Offline
        D Offline
        dipak dipak
        wrote on last edited by
        #3

        Sorry to say... no one answered for my question... but Finally I have solved my problem, i was suffering from this problem from last 3 days... lastly solution is that.. i have set different links for different sub folders. like src="scripts/utilityScripts.js" for root src="../scripts/utilityScripts.js" for subfolder and same for stylesheet link... And it is working fine... :-O :-O :-O :-O :-O :-O OK. :-O :-O :-O :-O :-O :-O

        Dipak

        A 1 Reply Last reply
        0
        • A Arun Jacob

          Use this in the Code behind

          ClientScript.RegisterClientScriptInclude("ScriptFile", ResolveClientUrl("~/JScript.js"));

          Arun J

          D Offline
          D Offline
          dipak dipak
          wrote on last edited by
          #4

          Thankx for reply.. Please tell me on which page i have to write this code..

          Dipak

          1 Reply Last reply
          0
          • D dipak dipak

            Sorry to say... no one answered for my question... but Finally I have solved my problem, i was suffering from this problem from last 3 days... lastly solution is that.. i have set different links for different sub folders. like src="scripts/utilityScripts.js" for root src="../scripts/utilityScripts.js" for subfolder and same for stylesheet link... And it is working fine... :-O :-O :-O :-O :-O :-O OK. :-O :-O :-O :-O :-O :-O

            Dipak

            A Offline
            A Offline
            Ashfield
            wrote on last edited by
            #5

            I would have expected Arun J's solution to work, but it seems you didn't bother trying it?

            Bob Ashfield Consultants Ltd

            1 Reply Last reply
            0
            • D dipak dipak

              Hello, I have a master page in my project and in master page i have defined all external links on header for javascript files and css files. And all .aspx pages (including sub folder pages) are under that single master page. all these are running Properly for .aspx page located in the root and not working properly for sub folder pages, when i am setting path like: And Not running Properly for .aspx page located in the root and Working Properly for subfolder pages, when i am setting path like: <script language="javascript" type="text/javascript" src="../scripts/myScript.js"> And link like src="~/scripts/myScript.js" not working for any one. Please give me suggestion how can i define external java script path to work properly from all (root / sub folder) files.. I will be very thankful to you... :-O <div class="ForumSig">Dipak </div>

              A Offline
              A Offline
              Abhishek Sur
              wrote on last edited by
              #6

              use link absolute to the Web server use ~/scripts/file.js like this way. I think it will work

              Abhishek Sur

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups