在网上看了一文章,说实现下载只要将资源的 url 放到叶面上就可以我这么做了但出现了错误:" The HTTP verb POST used to access path ' /WebSite/Upload/test1.rar 'is not allowed "请教诸位错误的原因、解决方法,以及使用ASP.NET实现下载的标准方法Thanks in advance.

解决方案 »

  1.   

    做个下载链接就行了,很简单的!<a href="文件地址"></a>
      

  2.   

    楼上的老大,先谢谢了我就是这么做的啊,运行时就出错误了:" The HTTP verb POST used to access path ' /WebSite/Upload/test1.rar 'is not allowed "
      

  3.   

    好像是你IIS设置post动作没设对吧....没见过...试下本地html文件不经服务器看.
      

  4.   

    呵呵这个是IIS问题,你应该设置IIS
      

  5.   

    楼主不能下载,我估计也是IIS的问题两种方法实现下载:
    一:直接用链接指向要下载的资源(就像楼主使用的方法)
    二:先在服务器读入资源,然后以流的方式实现下载
    如这里的函数
        public static void FileDownload(HttpContext context, string FullFileName)
            {
                FileInfo DownloadFile = new FileInfo(FullFileName);
                context.Response.Clear();
                context.Response.ClearHeaders();
                context.Response.Buffer = false;
                context.Response.ContentType = "application/octet-stream";
                //Response.ContentType = "application/ms-excel";
                context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));
                context.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
                context.Response.WriteFile(DownloadFile.FullName);            context.Response.Flush();
                context.Response.End();
            }
      

  6.   

    大哥们能不能讲一下IIS应该怎样配制?谢谢了
      

  7.   

    <a href="/web/ha.doc">download</a>...