I'm busy with that as well, it's very annoying resolveurl is that 'hidden'
So far i couldn't find it however, i already wrote a solution.
Please test again, it was a while i used this.
' Returns url based on virtual root, recommended to use for links etc..
' In case of asp:hyperlink or similar objects you better use ~/ instead
like:
'<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/default.aspx">HyperLink</asp:HyperLink>
' This call is ideal for html controls like:
'<a id="A2" href="<%=p.URL_GetRoot("NewFolder1/WebPage.aspx") %>">HTML
HyperLink</a>
Function URL_GetRoot(Optional ByVal sSubFolderFileToAdd As String = "") As
String
Dim Page As System.Web.UI.Page =
CType(System.Web.HttpContext.Current.Handler, System.Web.UI.Page)
sSubFolderFileToAdd = Trim(sSubFolderFileToAdd)
If Left(sSubFolderFileToAdd, 1) = "~" Then sSubFolderFileToAdd =
Mid$(sSubFolderFileToAdd, 2)
If Left(sSubFolderFileToAdd, 1) = "/" Then sSubFolderFileToAdd =
Mid$(sSubFolderFileToAdd, 2)
Return Page.ResolveUrl("~/" & sSubFolderFileToAdd)
End Function
"Navin Mishra" <na**********@siemens.com> schreef in bericht
news:eq****************@TK2MSFTNGP09.phx.gbl...
How to do the same for a webservice, inside an .asmx file, to get the
virtual directory path ?
Thanks in advance
Navin
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43***********************@text.nova.planet.nl ... in page load
me.resolveurl("~/webpage.aspx")
"Newbie" <me@me.com> schreef in bericht
news:e$**************@TK2MSFTNGP09.phx.gbl... >I want to determine proramatically from my webform what the virtual
>directory path is for my application.
>
> The reason for this is that I want to use some javascript code which needs > to access a file in a subdirectory. This is fine but my component will one > forms which some are in a subdirectory and some will be in the root
> directory. This is important when assembling the string needed for the
> Window.Open used by javascript link in the page.
>
> So to sum up. I need to know the url for the root of my application.
>
> http://MyHostName/VirtualDirectoryName
>
>
>
>
>