Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StaticFilesHttpHandler : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- if (context.Request.IsAuthenticated)
- {
- // continue with the request
- }
- else
- {
- throw new HttpResponseException(HttpStatusCode.Unauthorized);
- }
- }
- public bool IsReusable => false;
- }
- routes.RouteExistingFiles = true;
- routes.Add("helpRoute", new Route("folder/*.htm", new StaticFilesRouteHandler ()));
- public class StaticFilesRouteHandler : IRouteHandler
- {
- public IHttpHandler GetHttpHandler(RequestContext context)
- {
- return new StaticFilesHttpHandler ();
- }
- }
- <handlers>
- <add name="StaticFileHandler" verb="GET" path="~/help/default.htm" type="StaticFilesHttpHandler "/>
- </handlers>
Add Comment
Please, Sign In to add comment