HTTP 404 Error after encoding Url

前端 未结 2 1658
醉梦人生
醉梦人生 2021-01-29 04:09

When I use HttpUtility.UrlEncode to encode a Url I end up getting a server error.

ASP.Net code:

NavigateUrl=<%# HttpUtility.UrlEncode(string.Concat(\         


        
相关标签:
2条回答
  • 2021-01-29 04:13

    HttpUtility.UrlEncode() URL-encodes a string

    That means that it escapes all special characters from the string so that you can insert it as part of a URL without any characters being parsed as URL modifiers.

    You use this kind of escape function when inserting arbitary text as part of a URL.

    0 讨论(0)
  • 2021-01-29 04:16

    You shouldn't encode the entire URL, atleast not the 1st "?" symbol. If you encode the ? too then your application looks for a file with the name & extension "UpdateMember.aspx%3fgroupId%3d0032409901" which doesn't exist.

    Probably, this is what you should do.

    http://localhost/UITest/MM/UpdateMember.aspx?groupId%3d0032409901
    
    0 讨论(0)
提交回复
热议问题