我没有使用URL重写,我的应用程序工作正常,直到我试图通过我已动态生成的链接打到.PDF文件甚至是.TXT文件为止LinkButton的PostBackUrl。路径是正确的。用于访问路径的HTTP动词POST是不允许的
我已经彻底研究了这里这个问题,大多数问题与使用人POST操作或不或URL重写,这我不是。
在IIS错误的样子:
Server Error in Application "DEFAULT WEB SITE/EVENTS"Internet Information Services 7.5
Error Summary
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used. Detailed Error Information
Module StaticFileModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x80070001
Requested URL http://localhost:80/Events/EventDocs/48ea946f-e948-e011-ad73-00155d0e670b/2011.pdf
Physical Path C:\projects\Events\EventDocs\48ea946f-e948-e011-ad73-00155d0e670b\2011.pdf
代码动态生成的URL点击这里:
public void DocumentsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
LinkButton LinkToDoc = (LinkButton)e.Item.FindControl("LinkToDoc");
Label FileNameLabel = (Label)e.Item.FindControl("FileNameLabel");
LinkToDoc.PostBackUrl = "~/EventDocs/" + SessionValue.EventId.ToString() + "/" + FileNameLabel.Text;
LinkToDoc.Text = FileNameLabel.Text;
}
你得到一个错误信息?也许你可以发布一些代码,这将有所帮助... –