System.Web.StaticFileHandler has a limit?

Discussion in 'ASP .Net' started by =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=, Oct 24, 2006.

  1. Hi

    I tried to secure non .aspx files from unauthorized downloading with the
    common method: Assign the file extension of the to be secured files in IIS to
    aspnet_isapi.dll and map the extension in the web.config file to the
    System.Web.StaticFileHandler.

    It works, with the exception of one big problem:

    Bigger files can't be downloaded. If I try to download secured files that
    are below 30 mb, it works fine, but around 30 or more, i get an 404.
    It seems that System.Web.StaticFileHandler has a limit. How can I circumvent
    it?
     
    =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=, Oct 24, 2006
    #1
    1. Advertising

  2. From a previous post by David Wang of Microsoft:

    "The problem with the proposed solution is that static files are now handled
    by ASP.Net StaticFileHandler instead of IIS StaticFileHandler.

    IIS StaticFileHandler is about as optimized as it gets - full support of
    HTTP.SYS kernel mode response caching, built in file response caching, and
    pure native code with no managed code interop.

    ASP.Net StaticFileHandler had problems with large file sizes, memory
    buffer/usage, kernel mode response caching, and introduces managed code
    interop. Its history is non-optimal."

    In 2.0, there's a new method to the Response object named TransmitFile. The
    StaticFileHandler automatically uses it for files larger than 400 megs.

    There's a hotfix for this method for 1.x that you can download at:
    http://support.microsoft.com/kb/823409/EN-US/

    if you ARE using 2.0...the only think I can think of is that you write your
    own handler which ALWAYS uses TransmitFile....

    Karl

    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "the friendly display name"
    <> wrote in message
    news:...
    > Hi
    >
    > I tried to secure non .aspx files from unauthorized downloading with the
    > common method: Assign the file extension of the to be secured files in IIS
    > to
    > aspnet_isapi.dll and map the extension in the web.config file to the
    > System.Web.StaticFileHandler.
    >
    > It works, with the exception of one big problem:
    >
    > Bigger files can't be downloaded. If I try to download secured files that
    > are below 30 mb, it works fine, but around 30 or more, i get an 404.
    > It seems that System.Web.StaticFileHandler has a limit. How can I
    > circumvent
    > it?
     
    Karl Seguin [MVP], Oct 24, 2006
    #2
    1. Advertising

  3. I am using .net 2.0 (partially)

    If staticfilehandler in 2.0 automaticaly calls transmitfile.. why doesn't it
    do it with my app? Is it bug? Any idea?

    btw. i am using .net 2.0 on the server, but I compiled the app on .net 1.1
    (VS 2003). But, that shouldn't be a problem, because the jitting happens on
    2.0 (server machine: windows 2003, iis6, net 2.0)

    Thanks for the answer

    "Karl Seguin [MVP]" wrote:

    > From a previous post by David Wang of Microsoft:
    >
    > "The problem with the proposed solution is that static files are now handled
    > by ASP.Net StaticFileHandler instead of IIS StaticFileHandler.
    >
    > IIS StaticFileHandler is about as optimized as it gets - full support of
    > HTTP.SYS kernel mode response caching, built in file response caching, and
    > pure native code with no managed code interop.
    >
    > ASP.Net StaticFileHandler had problems with large file sizes, memory
    > buffer/usage, kernel mode response caching, and introduces managed code
    > interop. Its history is non-optimal."
    >
    > In 2.0, there's a new method to the Response object named TransmitFile. The
    > StaticFileHandler automatically uses it for files larger than 400 megs.
    >
    > There's a hotfix for this method for 1.x that you can download at:
    > http://support.microsoft.com/kb/823409/EN-US/
    >
    > if you ARE using 2.0...the only think I can think of is that you write your
    > own handler which ALWAYS uses TransmitFile....
    >
    > Karl
    >
    > --
    > http://www.openmymind.net/
    > http://www.fuelindustries.com/
    >
    >
    > "the friendly display name"
    > <> wrote in message
    > news:...
    > > Hi
    > >
    > > I tried to secure non .aspx files from unauthorized downloading with the
    > > common method: Assign the file extension of the to be secured files in IIS
    > > to
    > > aspnet_isapi.dll and map the extension in the web.config file to the
    > > System.Web.StaticFileHandler.
    > >
    > > It works, with the exception of one big problem:
    > >
    > > Bigger files can't be downloaded. If I try to download secured files that
    > > are below 30 mb, it works fine, but around 30 or more, i get an 404.
    > > It seems that System.Web.StaticFileHandler has a limit. How can I
    > > circumvent
    > > it?

    >
    >
    >
     
    =?Utf-8?B?dGhlIGZyaWVuZGx5IGRpc3BsYXkgbmFtZQ==?=, Oct 24, 2006
    #3
  4. Sorry almost lost this thread...

    It only uses TransmitFile if the file is larger than 400 megs. That's why
    I'm suggesting you write your own to ALWAYS use TransmitFile - frankly,
    that's how StaticFileHandler should be done..

    Karl

    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "the friendly display name"
    <> wrote in message
    news:...
    >I am using .net 2.0 (partially)
    >
    > If staticfilehandler in 2.0 automaticaly calls transmitfile.. why doesn't
    > it
    > do it with my app? Is it bug? Any idea?
    >
    > btw. i am using .net 2.0 on the server, but I compiled the app on .net 1.1
    > (VS 2003). But, that shouldn't be a problem, because the jitting happens
    > on
    > 2.0 (server machine: windows 2003, iis6, net 2.0)
    >
    > Thanks for the answer
    >
    > "Karl Seguin [MVP]" wrote:
    >
    >> From a previous post by David Wang of Microsoft:
    >>
    >> "The problem with the proposed solution is that static files are now
    >> handled
    >> by ASP.Net StaticFileHandler instead of IIS StaticFileHandler.
    >>
    >> IIS StaticFileHandler is about as optimized as it gets - full support of
    >> HTTP.SYS kernel mode response caching, built in file response caching,
    >> and
    >> pure native code with no managed code interop.
    >>
    >> ASP.Net StaticFileHandler had problems with large file sizes, memory
    >> buffer/usage, kernel mode response caching, and introduces managed code
    >> interop. Its history is non-optimal."
    >>
    >> In 2.0, there's a new method to the Response object named TransmitFile.
    >> The
    >> StaticFileHandler automatically uses it for files larger than 400 megs.
    >>
    >> There's a hotfix for this method for 1.x that you can download at:
    >> http://support.microsoft.com/kb/823409/EN-US/
    >>
    >> if you ARE using 2.0...the only think I can think of is that you write
    >> your
    >> own handler which ALWAYS uses TransmitFile....
    >>
    >> Karl
    >>
    >> --
    >> http://www.openmymind.net/
    >> http://www.fuelindustries.com/
    >>
    >>
    >> "the friendly display name"
    >> <> wrote in message
    >> news:...
    >> > Hi
    >> >
    >> > I tried to secure non .aspx files from unauthorized downloading with
    >> > the
    >> > common method: Assign the file extension of the to be secured files in
    >> > IIS
    >> > to
    >> > aspnet_isapi.dll and map the extension in the web.config file to the
    >> > System.Web.StaticFileHandler.
    >> >
    >> > It works, with the exception of one big problem:
    >> >
    >> > Bigger files can't be downloaded. If I try to download secured files
    >> > that
    >> > are below 30 mb, it works fine, but around 30 or more, i get an 404.
    >> > It seems that System.Web.StaticFileHandler has a limit. How can I
    >> > circumvent
    >> > it?

    >>
    >>
    >>
     
    Karl Seguin [MVP], Oct 25, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    5
    Views:
    1,056
    Gaurav Vaish \(www.Edujini-Labs.com\)
    Jan 10, 2007
  2. Replies:
    1
    Views:
    1,097
    Victor Bazarov
    Jun 28, 2005
  3. digitalcolony

    StaticFileHandler and Encoding as UTF-8

    digitalcolony, Jun 18, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    363
    digitalcolony
    Jun 18, 2007
  4. Mainframe05
    Replies:
    0
    Views:
    376
    Mainframe05
    Sep 18, 2009
  5. Nathan Sokalski
    Replies:
    4
    Views:
    321
    Nathan Sokalski
    Dec 21, 2006
Loading...

Share This Page