Home All Groups Group Topic Archive Search About
Author
22 Dec 2005 3:55 PM
Newbie
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

Author
22 Dec 2005 4:08 PM
Edwin Knoppert
in page load
me.resolveurl("~/webpage.aspx")

Show quoteHide quote
"Newbie" <m*@me.com> schreef in bericht
news:e$R2WAxBGHA.1676@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
>
>
>
>
>
Are all your drivers up to date? click for free checkup

Author
24 Dec 2005 1:40 PM
Navin Mishra
How to do the same for a webservice, inside an .asmx file, to get the
virtual directory path ?

Thanks in advance

Navin
Show quoteHide quote
"Edwin Knoppert" <n***@hellobasic.com> wrote in message
news:43aacfdd$0$10080$ba620dc5@text.nova.planet.nl...
> in page load
> me.resolveurl("~/webpage.aspx")
>
> "Newbie" <m*@me.com> schreef in bericht
> news:e$R2WAxBGHA.1676@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
> >
> >
> >
> >
> >
>
>
Author
24 Dec 2005 8:25 PM
Edwin Knoppert
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


Show quoteHide quote
"Navin Mishra" <navin.mis***@siemens.com> schreef in bericht
news:eq2Xl%23ICGHA.1180@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" <n***@hellobasic.com> wrote in message
> news:43aacfdd$0$10080$ba620dc5@text.nova.planet.nl...
>> in page load
>> me.resolveurl("~/webpage.aspx")
>>
>> "Newbie" <m*@me.com> schreef in bericht
>> news:e$R2WAxBGHA.1676@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
>> >
>> >
>> >
>> >
>> >
>>
>>
>
>
Author
25 Dec 2005 2:35 PM
Navin Mishra
Thanks. Can it be used inside an asmx web method ?

Show quoteHide quote
"Edwin Knoppert" <i***@pbsoft.speedlinq.nl> wrote in message
news:dokart$g57$1@azure.qinip.net...
> 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" <navin.mis***@siemens.com> schreef in bericht
> news:eq2Xl%23ICGHA.1180@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" <n***@hellobasic.com> wrote in message
> > news:43aacfdd$0$10080$ba620dc5@text.nova.planet.nl...
> >> in page load
> >> me.resolveurl("~/webpage.aspx")
> >>
> >> "Newbie" <m*@me.com> schreef in bericht
> >> news:e$R2WAxBGHA.1676@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
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Author
25 Dec 2005 5:27 PM
Edwin Knoppert
try.. don't know



Show quoteHide quote
"Navin Mishra" <navin.mis***@siemens.com> schreef in bericht
news:%23eNiBCWCGHA.3292@TK2MSFTNGP09.phx.gbl...
> Thanks. Can it be used inside an asmx web method ?
>
> "Edwin Knoppert" <i***@pbsoft.speedlinq.nl> wrote in message
> news:dokart$g57$1@azure.qinip.net...
>> 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" <navin.mis***@siemens.com> schreef in bericht
>> news:eq2Xl%23ICGHA.1180@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" <n***@hellobasic.com> wrote in message
>> > news:43aacfdd$0$10080$ba620dc5@text.nova.planet.nl...
>> >> in page load
>> >> me.resolveurl("~/webpage.aspx")
>> >>
>> >> "Newbie" <m*@me.com> schreef in bericht
>> >> news:e$R2WAxBGHA.1676@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
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>

Bookmark and Share