[CLOSED] [1.0] MVC and Exception reporting during file upload in IE not working

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] [1.0] MVC and Exception reporting during file upload in IE not working

    Hi,

    It's been a long time I took updates and after I recently did so, my MVC error reporting framework stopped working under IE (it was all working well before). I can replicate the problem with your MVC sample application (I took it from http://extnet-mvc.googlecode.com/svn/trunk) with the changes below. The code is very simple just to illustrate the problem. After the changes follow these steps:

    1. Login to the application and go to http://localhost:YOUR_PORT_HERE/Home/Form
    2. select a file for upload
    3. click submit
    4. under FireFox (I use 3.6.12) an error will be displayed which is the correct behavior
    5. under IE (I use 8) the alert box saying 'success' will be displayed, which is wrong.

    The code changes:

    Add this class:
    [AttributeUsage( AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true )]
        public class ExceptionFilterAttribute : FilterAttribute, IExceptionFilter
        {
            public void OnException( ExceptionContext filterContext )
            {
                if ( filterContext.ExceptionHandled )
                {
                    return;
                }
                filterContext.ExceptionHandled = true;
                filterContext.HttpContext.Response.StatusCode = 500;
                filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
                filterContext.Result = new AjaxResult
                {
                    ErrorMessage = "Error",
                    IsUpload = true
                };
            }
        }
    Change the HomeController.SaveForm method to this:


    [ExceptionFilter]
            public AjaxFormResult SaveForm(string txtName, string txtEmail, string txtComments)
            {
                throw new ApplicationException();
            }
    Change Form.aspx file to this:

    %@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
        <script type="text/javascript">        
            var failureHandler = function(form, action) {            
                Ext.MessageBox.show({
                    title: 'Failure',
                    msg: action.result.errorMessage,
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.ERROR
                });
            };
    
            var success = function(form, action) {
                alert('success');
            };
        </script>
    
    </head>
    
    <body>
        <ext:ResourceManager runat="server" ScriptMode="Debug" />
        
        <ext:FormPanel 
            ID="FormPanel1" 
            runat="server" 
            Url="~/Home/SaveForm/"
            Border="false" 
            FileUpload="true"
            BodyStyle="padding:5px 5px 0px;" 
            Layout="form"       
            LabelAlign="Top">
            <Items>
                <ext:Panel runat="server" Border="false" Height="100">
                    <Items>
                       <ext:FileUploadField runat="server" ButtonText="..."/>                    
                    </Items>
                </ext:Panel>                   
            </Items>
            <Buttons>
                <ext:Button runat="server" Text="Send">
                    <Listeners>
                        <Click Handler="#{FormPanel1}.getForm().submit({ waitMsg : 'Sending...', success : success, failure: failureHandler });" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:FormPanel>
    </body>
    </html>
    I used Ext.NET compiled freshly from SVN. Is this a bug or the whole process needs some different handling?

    Regards,
    Tadeusz
    Last edited by Daniil; Nov 08, 2010 at 6:00 AM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] multiple file upload and file size at client side
    By mirwais in forum 1.x Legacy Premium Help
    Replies: 24
    Last Post: Dec 15, 2014, 5:44 AM
  2. [CLOSED] File upload control not working in IE8
    By majestic in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 15, 2011, 4:02 PM
  3. Replies: 1
    Last Post: Jun 23, 2011, 9:37 AM
  4. [CLOSED] file upload - file name is empty
    By stoque in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 11, 2011, 8:06 PM
  5. [CLOSED] Help with file upload
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 09, 2010, 8:02 PM

Posting Permissions