ASHX HTTP Handlers and forms authentication

3.2k Views Asked by At

I have an ashx handler that I use to upload files from a flex page. I have been unable to extend forms authentication to protect the ashx file. Is there anyway to do this?

2

There are 2 best solutions below

1
On

You can always check context.Request.IsAuthenticated in your .ashx file. (link)

2
On

You could ways add a web.config file in the same directory as the ashx file with the following contents (i think):

  <?xml version="1.0" encoding="utf-8" ?>
  <configuration>

    <system.web>

      <authorization>
        <deny users="?"/>
      </authorization>

    </system.web>
  </configuration>