|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Virtual DirectoryI 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 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 > > > > > 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 > > > > > > > > > > > > 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 >> > >> > >> > >> > >> > >> >> > > 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 > >> > > >> > > >> > > >> > > >> > > >> > >> > > > > > > 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 >> >> > >> >> > >> >> > >> >> > >> >> > >> >> >> >> >> > >> > >> >> > >
Other interesting topics
vs2005 debugging on ws2k3 server
Net runtime crash Single Login Problem PreRender event question How to change the timeout value Storing an array to a Session 2.0 height %'s not working When does Application_AuthenticateRequest fires? Tags inside value field of appsettings in web.config Path conversion |
|||||||||||||||||||||||