Ajaxuploader under IIS7 asp.net 4.0 100% working solution all browser support!

Last post 11-25-2010, 10:47 AM by ThomaxVision. 4 replies.
Sort Posts: Previous Next
  •  11-20-2010, 7:12 PM 65107

    Ajaxuploader under IIS7 asp.net 4.0 100% working solution all browser support!

    HI, after my first struggle to get this to work i finely found a way, i just want to share this
    to every one that use iis7 asp.net 4.0 and C# / VB. 
    (there is still 1 big issue that should be focus on, i wrote info about that in the end here, but there is a solution to it)

    Before i start i just want to say a few words. There are not many good Upload controllers out there, that support all browsers.
    I think i tried every one that is on the web. (will not recommend obout or telerik). More i worked with this,
    more i see how much work have been done to this AjaxUploader controller.  This uploader does not interfere with any
    of my other codes. I am really happy how flexible this controller works.

    I will share how i made it to work 100% here this is what you need:

    Web.config:
     <appSettings>
     <add key="CuteWebUI.AjaxUploader.TempDirectory" value="~/Tempfolder"/>
     <add key="CuteWebUI.AjaxUploader.GlobalMaxSizeKB" value="2097151"/>
     </appSettings>
    <system.web>
     <assemblies>
         <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    </assemblies>
    ### Start Classic Application Pool Mode (doest not work in Integrated Application Pool mode)  ###
     <httpHandlers>
          <remove verb="*" path="*.asmx"/>
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
        </httpHandlers>
        <httpModules>
          <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
        </httpModules>
     </system.web>
    ### End Classic Application Pool Mode ###
      <httpRuntime maxRequestLength="2097151" executionTimeout="1200" />       
     <pages  viewStateEncryptionMode="Never" enableEventValidation="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"   autoEventWireup="true" validateRequest="false"  />
    ### Integrated Application Pool modules   ###
     <system.webServer>
      <modules>
       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/>
      </modules>
     </system.webServer>
    the aspx page header:
    <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
    <%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
     
     <CuteWebUI:Uploader runat="server" ID="Uploader1" InsertText="Upload File" OnFileUploaded="Uploader_FileUploaded"></CuteWebUI:Uploader><br />
        <asp:Button ID="ButtonPostBack" Text="Save" runat="server" OnClick="ButtonPostBack_Click" Width="54px" /><br />
        <asp:Literal runat="server" ID="txtinfoBox"></asp:Literal>  
     
    The codebehind:
     
    using System.IO;
    using System.Text;
    using CuteWebUI;
     
        protected void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {
            Session["FileName"] = args.FileName;   
            string PathX = Server.MapPath("../files/");
            string filename = Convert.ToString(Session["FileName"]);

            if (File.Exists(PathX + filename) == true)
            {
                txtinfoBox.Text += "<br /> Filen " + filename + " File was overwritten in " + PathX + " <br />";
                File.Delete(PathX + filename);
            }        
            args.MoveTo("../files/" + args.FileName);        
            txtinfoBox.Text += "Status: <b>" + filename + "</b> Was saved" + "<hr>";
       }
     
    This works just great, you can use this also in a usercontroll without any problem, just make sure
    you dont access the page with Folder/  without the Default.asp in the link else you get a error. (thx for clearing that up Keeneth)
     

    My urly problem was that this code didnt work without the HttpHandlers and HttpModules. And if i added it to the server, it
    dident load the page because this is not supported by iis7 in Integrated Application Pool mode, you can use :
     
    <configuration>
    <!-- This is for Classic Application Pool -->
    <system.web>
    <httpModules>
    <add name="IntranetPageHttpModule" type="CoTs.Intranet.IntranetPageHttpModule" />
    </httpModules>
    <httpHandlers>
    </httpHandlers>
    </system.web>
    <!-- This is for Integrated Application Pool -->
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
    <add name="IntranetPageHttpModule" type="CoTs.Intranet.IntranetPageHttpModule" />
    </modules>
    <handlers>
    </handlers>
    </system.webServer>
    </configuration>

    I hope Cutesoft make this great controller without the need of httpHandlers and httpModules since this are discontinued in iis7.


    Thank you!
     
  •  11-23-2010, 7:27 PM 65130 in reply to 65107

    Re: Ajaxuploader under IIS7 asp.net 4.0 100% working solution all browser support!

    ThomaxVision ,
     
    Thanks for the helpful information.
     
    We will investigate the IIS7 more.
     
    Regards,
    Terry
  •  11-23-2010, 9:33 PM 65145 in reply to 65130

    Re: Ajaxuploader under IIS7 asp.net 4.0 100% working solution all browser support!

    cutechat:
    ThomaxVision ,
     
    Thanks for the helpful information.
     
    We will investigate the IIS7 more.
     
    Regards,
    Terry
     
    Your welcome Terry.  I think for to day / now, most people use iis7 in classic mode due to the fact that
    iis7 is pretty new and allot of other apps maybe have problem with the very same thing. I had a nice
    chat with my server partner to day, and they said that they will stick to classic pool for a very long time,
    so i guess this is in no rush atm.

    Btw, nice forum. When can we buy it ? :)


    Regards
    Thomas
  •  11-24-2010, 7:18 PM 65155 in reply to 65145

    Re: Ajaxuploader under IIS7 asp.net 4.0 100% working solution all browser support!

    Hi ThomaxVision,
     
    Please refer to http://ajaxuploader.com/Order.aspx or contact Karen directly (Karen@CuteSoft.net), she will explain to you on detail.
     
    Regards,
     
    ken
  •  11-25-2010, 10:47 AM 65165 in reply to 65155

    Re: Ajaxuploader under IIS7 asp.net 4.0 100% working solution all browser support!

    Hi Ken, i already payed for dev lic. I talk to Karen if i have any questions. Thank you.
View as RSS news feed in XML