how to render the relative path with tilde into ../../ of relative path in jquery/javascript?

前端 未结 4 493
离开以前
离开以前 2021-02-06 16:50

Well, i understand my title is a bit confusing. I will state it clearly below with the example.



        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 17:25

    Actually, URLs with tilde get converted to absolute URL thanks to the methods : ResolveURL and ResolveClientURL

    Therefore you should be able to do this :

    " style="border-width:0px;">
    

    (this is actually done automatically for you in Web Controls like HyperLink and such)

    The big difference with those two methods happens when you use User-controls. In a case, the URL refers to the URL relative to the folder where the user-control is, in the other case, that would be the page containing the user-control.

    See also this question : Control.ResolveUrl versus Control.ResolveClientUrl versus VirtualPathUtility.ToAbsolute

提交回复
热议问题