编码后的网址HTTP 404错误 [英] HTTP 404 Error after encoding Url
问题描述
当我使用HttpUtility.UrlEn code到EN code的URL我最终得到了服务器错误。
When I use HttpUtility.UrlEncode to encode a Url I end up getting a server error.
ASP.Net code:
ASP.Net code:
NavigateUrl=<%# HttpUtility.UrlEncode(string.Concat("UpdateMember.aspx","?groupId=", DataBinder.Eval(Container.DataItem, "GroupID").ToString())) %>
网址:
http://localhost/UITest/MM/UpdateMember.aspx%3fgroupId%3d0032409901
这会导致HTTP错误404.0 - 未找到
您正在寻找已被删除的资源,更名或暂时不可用。
which results in "HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
不过使用:
NavigateUrl=<%# string.Concat("UpdateMember.aspx","?groupId=", DataBinder.Eval(Container.DataItem, "GroupID").ToString()) %>
结果的网址:
http://localhost/UITest/MM/UpdateMember.aspx?groupId=0032409901
这工作了罚款。我做得不正确?
which works out fine. Am I doing something incorrectly?
推荐答案
您不应该带code。整个URL,ATLEAST非第一?
符号。如果你带code中的?过那么你的应用程序查找一个名为&放文件;扩展名UpdateMember.aspx%3fgroupId%3d0032409901不存在
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
这篇关于编码后的网址HTTP 404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!