?
Solved

get application path

Posted on 2006-05-10
7
Medium Priority
?
2,814 Views
Last Modified: 2008-01-09
Hi experts

i have some folders in my asp.net application
and all aspx page use the same JS file

but when i need to call a page in a JS Function
the page is not found by some others pages

for example

root

-folder1
--subfolder
---page1.aspx

-folder2
--page2.aspx

-page3.aspx
-JSFile


as you can see i don"t know how to launch the page3.aspx when i'm in page1.aspx and n page2.aspx

for now i use this :

var url = "../page3.aspx"
it works for page2.aspx not for page1.aspx

i also tried this with no success : "~/page3.aspx"

any suggestion?

regards
0
Comment
Question by:Dnx_7
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:xlt77
ID: 16654518
Use absolute url.
such as :  
/page3.aspx
/folder2/page2.aspx
/folder1/subfolder/page1.aspx
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 16656058
hmm

is there no way to use a single path for calling page3.aspx
wherever i am in the website?

because if i do that : "/page3.aspx"
then if i am in the page2.aspx
and call the js function
the client will try to get that page : /subfolder2/Page3.aspx


regards
0
 
LVL 2

Accepted Solution

by:
xlt77 earned 1500 total points
ID: 16656606
Oh?

For my option, "/page3.aspx" is the web site root + '/page3.aspx' .
If your web site is "http://www.yoursite.com" , and wherever your current path is, your can redirect to "http://www.yoursite.com/page3.aspx" with link '/page3.aspx' .

The path analysis rule is :
./  -- current path
../ -- parent path
/   -- root path

Or, you can use  'http://'+document.domain + '/page3.aspx' to visite page3.aspx wherever your current path is.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:Dnx_7
ID: 16656644
i see

in fact i use a window.open("/page3.aspx"...)


don't you think there is something different?

0
 
LVL 1

Expert Comment

by:Nightfalcon
ID: 16657937
Hi Dnx_7,

It all depends on where you use the window.open-instruction.

If you call this from the root, you should use window.open(./page3.aspx) (using your current path)
If you call this from page1.aspx, you should use window.open(../page3.aspx) (using the parent path from your current location)

Hopes this helps

Night
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 16657966
in fact i don't know where i can call the page that's why i wish to use a full path (generic path) for calling the page3.aspx wherever i am in the website

in many page i just call the function

doIt(urlParam);

and the doIt function open the urlParam

regards
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 16663751
thanks i use that way : document.domain...

regards
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question