Control.ResolveUrl versus Control.ResolveClientUrl versus VirtualPathUtility.ToAbsolute

前端 未结 4 507
無奈伤痛
無奈伤痛 2020-11-30 07:37

Is there any benifit to using one of these methods over the other when resolving paths which start with the tilde (~)?

Generally, what is a better practice, should y

4条回答
  •  Happy的楠姐
    2020-11-30 08:16

    Another difference I noticed:

    Code:

    string value = "~/Docs/Hello & World.aspx"; Response.Write(HyperLink1.ResolveClientUrl(value) + "
    ");
    Response.Write(HyperLink1.ResolveUrl(value) + "
    ");

    Result:

    Docs/Hello%20&%20World.aspx

    /Docs/Hello & World.aspx

提交回复
热议问题