Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to set relative url for window.open and hyperlink

0 views
Skip to first unread message

tomek.ro...@gmail.com

unread,
Apr 27, 2008, 11:44:26 AM4/27/08
to
Hi !

I have a problem with defining a relative url, which is one of
parameters of window.open call.
Here is the situation:

1. "Parent" page called 2000 is in subfolder of my app, the subfolder
is called Z.
2. On the 2000 page there is an asp hyperlink, which should open new
window with 2010 page. But since the window can't have browser menu
etc. I set onclick attribute with window.open command instead of
NavigateUrl property.
3. The 2010 page is also located in Z subfolder.
4. As an url of hyperlink I set /Z/2010.aspx
I tried also ~/Z/2010/aspx but it never worked.
5. Everything works fine when my app is run against Visual Studio
build in server. I mean the 2010 page opens in new browser window when
hyperlink is clicked, opens under url
http://localhost:2554/Z/2010.aspx page

6. The above doesn't work when app is deployed on IIS. Browser
attempts to open
http://localhost/Z/2010.aspx page
while it should be
http://localhost/MyApp/Z/2010.aspx.

What is wrong ?

tomek.ro...@gmail.com

unread,
Apr 28, 2008, 4:18:26 AM4/28/08
to
I found solution for that: the url which is passed to window.open must
be full url.
To get "prefix" I call
this.ResolveClientUrl("~/Z/2010.aspx")
and tylda character (~) is replaced automatically as needed.
0 new messages