ASP.NET relative path

后端 未结 3 607
旧时难觅i
旧时难觅i 2021-02-12 12:35

I\'m confused with ASP.NET relative path, please can someone help?

In a Master Page I gave a link label referencing:



        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-12 13:06

    Because you're using it directly in markup, rather than in a server control. Something as simple as this should fix it:

    Login
    

    Basically, the ~ path reference needs to be translated on the server, since it's a reference to the server path of the application's base directory. Plain HTML markup isn't processed on the server, it's just delivered as-is to the client. Only server-processed code will translate the ~ path to what it resolves to.

提交回复
热议问题