Jeffrey Zhao写的AjaxFileUploadHelper控件问题

因为项目需要,在上传文件的时候,临时使用了Jeffrey Zhao写的AjaxFileUploadHelper控件。
但是在使用 的过程中遇到了这样的问题:

在页面中使用了 IETreeView 控件发生这个错误的,但是在我建立的测试项目中发生的是500错
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

找了半天也不知道是什么原因。给其发了2个邮件,也不见丝毫回应.....

只好查源代码:发现在其写的控件中有一个Page_Error函数被触发。
         
       private   void  EnsureIsInAjaxFileUploading()
      
{
            
this.isInAjaxUploading = AjaxFileUploadUtility.IsInIFrameAsyncPostBack(this.Page.Request.Params);
            
//this.Page.Error += new EventHandler(Page_Error);
            if (this.isInAjaxUploading)
            
{
                isInAsyncPostBackFieldInfo.SetValue(
                    ScriptManager.GetCurrent(
this.Page),
                    
true);

                
this.Page.Error += new EventHandler(Page_Error);
            }


        }


        
private   void  Page_Error( object  sender, EventArgs e)
        
{

            AjaxFileUploadUtility.WriteScriptBlock(
this.Page.Response, true);

            onPageErrorMethodInfo.Invoke(
this.PageRequestManager, new object[] ...{ sender, e });

            AjaxFileUploadUtility.WriteScriptBlock(
this.Page.Response, false);
        }



可是还是解决不了问题。

于是在原来的页面下.aspx的cs文件中增加了一个函数
      
protected   void  Page_Error( object  sender, EventArgs e)
        
{
            Exception ex 
= Server.GetLastError();
            Server.ClearError();
          
        }

截获了Exception。发现因为Exception的存在影响了老赵控件的作用。
将整个Exception解除之后,UploadHelper控件正常工作
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值