最近刚开始学.net 想从网上找点代码练手的,遇到个代码,有点看不明白,请大佬们指点一下:
using ServiceImpls.WebEnterprise;
using Web.ashx;
using System;
using System.Web;
using System.Web.Services;
namespace testswfupload
{
[WebService(Namespace = "http://tempuri.org/"), WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class upload : HandlerBase
{
protected override void DoProcessRequest(HttpContext context)
{
for (int i = 0; i < context.Request.Files.Count; i++)
{
HttpPostedFile httpPostedFile = context.Request.Files[i];
if (httpPostedFile != null && httpPostedFile.ContentLength != 0 && !string.IsNullOrEmpty(httpPostedFile.FileName))
{
byte[] array = new byte[httpPostedFile.ContentLength];
httpPostedFile.InputStream.Read(array, 0, array.Length);
Upload(httpPostedFile.FileName);
}
}
}
}
}
这是我找的测试代码,通过upload.ashx调用
<%@ WebHandler Language="C#" CodeBehind="upload.ashx.cs" Class="testswfupload.upload" %>
我想测试一下这个代码的,但是无论怎么访问ashx页面都是空白的,我感觉像是路由没弄对导致函数没被调用,请问这种代码的话该怎么去看路由呢