Syntax for path

I'm trying to open a page in a new window. The page that I am trying to open is in a different folder than the page I am currently on.
The page I am on is in folder www.mywebsite/administrator/reports
The page I am trying to open is in folder  www.mywebsite/orders/crystal reports

Here is the command I am using
ScriptManager.RegisterClientScriptBlock(Me.UpdatePanel1, Me.UpdatePanel1.GetType(), "AnyScriptNameYouLike", "window.open('./orders/crystal reports/Print Order Cust.aspx');", True)

The problem is it tries to find the path in folder www.mywebsite/administrator/reports/
orders/crystal reports


What is the syntax to open the page in folder www.mywebsite/orders/crystal reports
whiwexAsked:
Who is Participating?
 
Gerry BartleySoftware EngineerCommented:
Oops I'm such a plank.
 tilde. ~ won't work with JavaScript

Try this
dim uri as string= Page.Request.Url.GetLeftPart(UriPartial.Authority) & "/orders/crystal reports/Print Order Cust.aspx"
dim jscript as string= string.Format("window.open('{0}');",uri)

ScriptManager.RegisterClientScriptBlock(Me.UpdatePanel1, Me.UpdatePanel1.GetType(), "AnyScriptNameYouLike", jscript, True)
0
 
käµfm³d 👽Commented:
Try using "%20" for the space:

e.g.

www.mywebsite/orders/crystal%20reports

Open in new window

0
 
Gerry BartleySoftware EngineerCommented:
Tilda or .. should work

ScriptManager.RegisterClientScriptBlock(Me.UpdatePanel1, Me.UpdatePanel1.GetType(), "AnyScriptNameYouLike", "window.open('~/orders/crystal reports/Print Order Cust.aspx');", True)
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
whiwexAuthor Commented:
I tried "window.open('//orders/crystal reports/Print Order Cust.aspx');", True)
but it searches in http://orders/crystal%20reports/Print%20Order%20Cust.aspx

I tried "window.open('~/orders/crystal reports/Print Order Cust.aspx');", True)

byt it searches in wwwmywebsite/administrator/reports/~/orders/crystal%20reports/Print%20Order%20Cust.aspx
0
 
whiwexAuthor Commented:
I tried "window.open('../orders/crystal reports/Print Order Cust.aspx');", True)

but it searches in I tried wwwmywebsite/administrator/orders/crystal%20reports/Print%20Order%20Cust.aspx
0
 
whiwexAuthor Commented:
Thanks I ended up using HttpContext.Current.Request.ApplicationPath
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.