473,411 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Virtual Directory

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

Dec 22 '05 #1
5 2016
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


Dec 22 '05 #2
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



Dec 24 '05 #3
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
>
>
>
>
>



Dec 24 '05 #4
Thanks. Can it be used inside an asmx web method ?

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:do**********@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" <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
>
>
>
>
>



Dec 25 '05 #5
try.. don't know

"Navin Mishra" <na**********@siemens.com> schreef in bericht
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks. Can it be used inside an asmx web method ?

"Edwin Knoppert" <in**@pbsoft.speedlinq.nl> wrote in message
news:do**********@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" <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
>> >
>> >
>> >
>> >
>> >
>>
>>
>
>



Dec 25 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeffry van de Vuurst | last post by:
Hi, (sorry for the crosspost, I wasn't sure which was the best place to put this). I was just thinking about something and wondered if any of you has some ideas about this. I'm using the...
5
by: Leszek | last post by:
Hello, Could anybody explain what's a difference between a virtual directory and an application root under IIS? I'm a little bit confused. This is mu problem: Let's assume the following...
4
by: david | last post by:
I basically use the following code to display the directory and file names in the WWWROOT, but can not show the virtual directory. ---- Dim path As String = Server.MapPath(x) Dim di As...
6
by: ManagedCoder | last post by:
Hi, My requirement is as follows: I need to set the HttpExpires (enable content expiration - set to 7 days) on a folder within a virtual directory. I have been able to set the HttpExpires...
6
by: Scott M. | last post by:
I didn't get a resolution to this in my earlier post, so I'll try again: System: Windows XP Pro. (SP2) with IIS installed and running PRIOR to VS 2008 Pro. installation. VS 2008 Pro. (full...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.