如何将页面文件路径转换为http url?

编程入门 行业动态 更新时间:2024-10-22 21:41:40
本文介绍了如何将页面文件路径转换为http url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

谁能告诉我,如何将页面文件路径转换为http url? 如果我通过下面的路径 /TempFolder/WebForm.aspx 那么它应该返回 www.abce/TempFolder/WebForm.aspx

Can any one tell me, How to convert a page file path to http url? If I pass the path below /TempFolder/WebForm.aspx then it should return www.abce/TempFolder/WebForm.aspx

推荐答案

显然您的问题还不完整.您处于某种情况下,您会获得相对路径,并且希望使用绝对路径. 发布完整方案将始终帮助您获得正确而准确的答复. 现在,看起来像是相对路径.使用Uri.Absolute路径获取完整路径. 如果需要,您可以使用任何已知文件及其路径来获取完整路径. 甚至一个请求/响应也将具有完整的网址.尝试! Clearly your question is not complete. You are in a certain scenario where you get relative path and you want to have absolute path to use. Posting complete scenario would always help you in getting proper and exact replies. For now, as it looks like, you are having relative path. Use Uri.Absolute path to get the complete path. If needed, you can use any known file and it''s path to get the full path. Even a Request/Response would have a complete Url. Try!

您可能会使用ResolveURL. msdn.microsoft/en-us/library/system.web.ui.control.resolveurl.aspx [ ^ ] 祝你好运! You could probably use ResolveURL. msdn.microsoft/en-us/library/system.web.ui.control.resolveurl.aspx[^] Good luck!

我想你可以做到的.喜欢 < a href ="TempFolder/WebForm.aspx">主页</a> < a href =〜/TempFolder/WebForm.aspx" id ="aDefault" runat ="server"></a> 因此,如果链接为runat ="server",则必须使用相对路径. I think you can do this, simply. Like <a href="TempFolder/WebForm.aspx">Home</a> <a href="~/TempFolder/WebForm.aspx" id="aDefault" runat="server"></a> so, if the link is runat="server" then you have to use relative path.

更多推荐

如何将页面文件路径转换为http url?

本文发布于:2023-11-01 12:33:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549346.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   如何将   路径   页面   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!