Cannot use a leading ../ to exit above the top directory

前端 未结 10 868
小蘑菇
小蘑菇 2020-11-30 08:37

I have a asp.net web site with it we have admin area with login page for admin only and all site is allowed for all - i need to ask how to define the right security configur

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 08:58

    I know these answers are enough, but I'll show the place that's throwing an error.

    If you have the structure like the below:

    • ./Src/Master.cs - (Master Form Page)
    • ./Invoice/SubFolder/InvoiceEdit.aspx - (Sub Form Page)

    If you enter the sub form page, you'll get an error when you use similar like that you've used in master page: Page.ResolveClientUrl("~/Style/img/logo_small.png").

    Now ResolveClientUrl is situated in the master page and trying to serve the root folder. But since you are in the subfolder, the function returns something like ../../Style/img/logo_small.png. This is the wrong way.

    Because when you're up two levels, you are not in the right place; you need to go up only one level, so something like ../.

提交回复
热议问题