代码上传压缩包,视频,图片都没问题,就是在上传pdf的时候什么错也不报,直接跳到无法显示该页面,惆怅的很~
代码帖出来,求高手指点!  case 2://上传会刊                    aentity.AudioType = 2;
                    string SavaBook = "Book/Audio/";
                    string BookURL = "";
                    string[] allowedExcBook = { ".pdf" };
                    size = 10 * 1024 * 1024;
                    flag = BLL.WebUtility.UploadFile(fuURL, SavaBook, allowedExcBook, size);
                    if (flag)
                    {
                        BookURL = BLL.WebUtility.Message;
                    }
                    else
                    {
                        ltMes.Text = "会刊格式有误,请重新选择!";
                        return;
                    }
                    if (BookURL == "") BookURL = hlURL.Text;
                    aentity.AudioURL = SqlHelper.FiltrateSqlString(BookURL);                    //会刊压缩包
                    string rarURL = "";
                    string[] allowedRAR = { ".rar", ".zip" };
                    size = 30 * 1024 * 1024;
                    flag = BLL.WebUtility.UploadFile(fuDow, SavaBook, allowedRAR, size);
                    if (flag)
                    {
                        rarURL = BLL.WebUtility.Message;
                    }
                    else
                    {
                        ltMes.Text = "下载文件格式上传有误!";
                        return;
                    }
                    if (rarURL == "") rarURL = hlDow.Text;
                    entity.AudioThumbnail = SqlHelper.FiltrateSqlString(rarURL);                    if (AudioEntityDA.Update(aentity))
                        MessageBox.ShowAndRedirect(this, "修改成功!", redirectUrl);
                    else
                        MessageBox.ShowAndRedirect(this, "修改失败!", redirectUrl);
                    break;
上传文件的方法        public static bool UploadFile(System.Web.UI.WebControls.FileUpload file, string filePath, string[] fileExts, int maxSize)
        {
            try
            {
                //验证文件非空、格式、大小
                if (file.PostedFile.ContentLength <= 0)
                {
                    message = "";
                    return true;
                }
                string ext = System.IO.Path.GetExtension(file.FileName);
                bool flag = false;
                foreach (string fileExt in fileExts)
                {
                    if (fileExt.ToLower() == ext.ToLower())
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    message = string.Format(errorFileExt, pageTitle);
                    return false;
                }
                if (file.PostedFile.ContentLength > maxSize)
                {
                    message = string.Format(errorFileSize, pageTitle);
                    return false;
                }                //如果路径不以/结尾,则添加
                if (!filePath.EndsWith("/"))
                {
                    filePath = filePath + "/";
                }
                //需要返回的值
                string fileName = DateTime.Now.ToString("yyyyMMddhhmmssffff") + ext;
                string fileUrl = HttpContext.Current.Server.MapPath(filePath);                //文件目录是否存在
                if (!System.IO.Directory.Exists(fileUrl))
                {
                    System.IO.Directory.CreateDirectory(fileUrl);
                }                file.PostedFile.SaveAs(fileUrl + fileName);                message = filePath + fileName;
                return true;
            }
            catch (Exception e)
            {
                message = e.Source + ":" + e.Message;
                return false;
            }