Problem with cutom HttpHandler RRS feed

  • Question

  • Hi,

      I've create a custom HttpHandler which handling *.aspx extension, but the problem is when I've handled some *.aspx page and next want to redirect to another page with *.aspx extension and then I've got infinite looping ;/ So it seems like again this another page is handled because it is *.aspx page and again and again.

    I don't why this works so strange ;/ Could you help me ?

    Friday, September 30, 2011 10:08 PM

All replies

  • Hi,


    Based on your explanation above the behavior is obvious. Based on my understanding, httphandler is used to handle the http requests considering the file extension(.aspx as you have told above). 

    So in your case when you handle the request coming from page abc.aspx, once you find out that the page is hiving the .aspx extension you redirect it to a page xyz.aspx . Again when the request comes for that xyz.aspx page, the handler considers the .aspx extension the xyz.aspx page is having and it will redirect again. This is the reason why it is going into infinite looping.

    Please let us know the exact solution you are looking for.



    Sharath Kumar Shivarama

    sharath kumart shivarama
    Saturday, October 1, 2011 5:12 PM
  • Hi,

      It looks exactly as you wrote above but my issue is to handle the page with *.aspx extension, check if user accepts some required terms (in this example, just click the button on the custom page) and if he didn't accept should be redirect to custom page with terms to accept - this custom page has also *.aspx extension, so the main reason is to block the user to view other pages in sharepoint if user doesn't accept some terms on custom page. So my first idea was to use httphandler. How could I make this in this scenario ?

    • Edited by CaMeL023 Saturday, October 1, 2011 6:29 PM
    Saturday, October 1, 2011 6:25 PM
  • This is something you should implement in a HttpModule rather than a HttpHandler. Its better suited for such filtering. In all cases you should create a cookie or something like this to keep track of the state if the user already accepted the terms of use or not to control the redirection.
    Stefan Goßner
    Senior Escalation Engineer - Microsoft CSS
    This post is provided "AS IS" with no warrenties and confers no rights.
    • Proposed as answer by Bhushan Gawale Saturday, October 1, 2011 7:43 PM
    Saturday, October 1, 2011 7:19 PM
  • I used DB to store information about user if he accepted terms. There are information such UserName and bit value (0,1). So if there are terms entry added to DB user is not redirected to accept terms but to some default page in Sharepoint. Hmm..so I should use another method to resolve this issue like HttpModule ?

    But I have some another idea, If there is a problem with redirect user to another page etc..it would be possible to hide some links in Quick Launch and Global Navigation for this time when user didn't accept terms on custom page - of course programatically ?

    • Edited by CaMeL023 Saturday, October 1, 2011 7:39 PM
    Saturday, October 1, 2011 7:36 PM