This project has moved. For the latest updates, please go here.

SqlServerUploadStorageProvider won't trigger OnClick event handler

Jun 21, 2011 at 12:45 AM

Hi everyone,

I'm trying to stream my upload files directly into the database using SqlServerUploadStorageProvider, but I'm it does not behave correctly. Using SqlServerUploadStorageProvider works great on my local development PC.  However, once I deployed the solution onto the live system, I can see the progress bar moves when I performed the upload operation but then the uploaded file got removed.  I monitored the DB and see the file being pushed into the DB, however, the OnClick="UploadBtn_Clicked" event handler never got invoked.  Hence, the uploaded file got removed because verify() was only called inside UploadBtn_Clicked() method (which was never invoked).

I'm currently using NeatUpload 1.3.36 and have switched between 4.0 and 4.0 Integrated Pipeline.  Here is my web.config settings that I used:

<?xml version="1.0" encoding="UTF-8"?>
      <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
          <add key="StreamBufferSize" value="2097152" />
       <add name="ArtistZone.Data" connectionString=...

        <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />

        <add assemblyName="Brettle.Web.NeatUpload"
                            a6b134b1" />


    <neatUpload defaultStorageProvider="SqlServerUploadStorageProvider">
        <add name="SqlServerUploadStorageProvider" type="Hitone.Web.SqlServerUploader.SqlServerUploadStorageProvider, Hitone.Web.SqlServerUploader"
             renameProcedure="RenameBlob" />

        <directoryBrowse enabled="false" />

        <modules runAllManagedModulesForAllRequests="true">
          <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" preCondition="managedHandler" />
        <validation validateIntegratedModeConfiguration="false" />       
            <rule name="LowerCaseRule1" stopProcessing="true">
              <match url="[A-Z]" ignoreCase="false" />
              <action type="Redirect" url="{ToLower:{URL}}" />
            <rule name="Redirect non-www to www" patternSyntax="Wildcard" stopProcessing="true">
              <match url="*" />
                <add input="{HTTP_HOST}" pattern="" />
              <action type="Redirect" url="{R:0}" />
            <rule name="RemoveTrailingSlashRule1" stopProcessing="true">
              <match url="(.*)/$" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
              <action type="Redirect" url="{R:1}" />

Any ideas on how I may debug this?  I'd appreciate any tip you may have.

Thanks, Loc Pham

Jun 21, 2011 at 4:41 PM

Is anyone actually reading this forum? If you know the answer, please help.

I was able to narrow the problem a bit further.  Seems like the UploadBtn_Clicked event handler sometimes got invoked.  The behavior I'm seeing is very inconsistent.  Sometimes after the first upload, I see UploadBtn_Clicked gets called right away.  On the other hand, it may takes 4 or 5 uploads before I see UploadBtn_Clicked gets called. 

If you can help, please respond.


Loc Pham


Jun 22, 2011 at 2:08 PM
Edited Jun 22, 2011 at 4:31 PM

I'm able to find out more detail on this problem, still, I have no solution yet....

After more debugging, the Button which triggered the SqlServerUpload never postback, however the Page_Load event did occur.  Because no postback occurred, the control event handler UploadBtn_Clicked was never invoked.

When I set the triggered button's UseSubmitBehavior="false", the postback did occur, but SqlServerInputFile1.HasFile evaluted to FALSE.

Another interesting fact, when I upload an image that is about 10KB, everything works fine.  When I upload an image that is about 700KB or larger, the problem is reproduced and postback won't occur.

With these information, the postback event is definitely relate to the timing of the file being streamed into the DB. This explain why it works on my local development but does not work on the production.  On my local development, all images 700KB or greater takes about 1 second to complete.  The missing postback is only encountered when streaming the file takes 5 seconds or more ...

So my question remains... where do I set this timeout and why does it occur???


Loc Pham

Jun 23, 2011 at 4:22 PM
Edited Jun 23, 2011 at 4:28 PM

Further debugging....

When I set the connectionString running on my localhost to point to the production DB, the SqlServer upload process works perfectly fine (even with large files).  However, once I deployed my project to the production server, it didn't work with large files (700KB or greater).  The control handler did not fire when I used asp:Button.  When I switched to asp:LinkButton, the handler was fired but then SqlServerInputFile1.HasFile evaluated to false.  I use the same web.config file for both my localhost and production server.

Jun 23, 2011 at 8:58 PM


I wish I could be of help, but honestly I've never used the SqlServerUploadStorageProvider myself and have no experience with it and would not know where to begin to try and figure out that one. It seems it must be some server configuration difference rather than a db issue. Even if the Web.config is the same things could be locked down in machine.config (or domain policy if on a windows domain) in a way so that some of the web.config settings doesn't get applied. Or differences in .NET service paks or windows updates or other factors might be something to look at.

Wish I could be of more help but that's all I got.