2

I have a custom handler in my code (Sitecore 9.3). In the web.config:

<handlers>
  <add name="JFSRedirect" verb="*" path="JFSRedirect.axd" type="Site.Feature.Journals.Handlers.JfsAuthenticationHandler, Site.Feature.Journals" />

The handler code

namespace Site.Feature.Journals.Handlers
{
    public class JfsAuthenticationHandler: IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            Log.Info("JfsAuthenticationHandler - Processing", this);
.....

However it doesn't get triggered when it's supposed to. I land on this URL, which you can see contains the path "JFSRedirect.axd":

https://site.erica.velir.sc/news-and-publications/scientific-journals?nextUrl=https%3a%2f%2fsite.erica.velir.sc%2fjfsredirect.axd%3farticle%3dhttps%3a%2f%2fjournals.com%2fjournal%2f17503841

Am I missing something in the configuration, or is my URL incorrect for triggering the handler?

2
  • 1
    You're missing wildcards in the path config, but even then I think the path in the config is your actual path and not the querystring. You could try to fetch all requests and test the path in the code.
    – Gatogordo
    Jan 12 at 17:07
  • Explanation, what @Gatogordo said about the path The path that IIS tries to match is site.erica.velir.sc/news-and-publications/scientific-journals. It doesn't match JFSRedirect.axd. That is why it would not be triggered.
    – Anton
    Jan 12 at 17:14
1

As mentioned in the comment, the path does not include your querystring - and is missing wildcard(s).

If you want to intercept all urls with JFSRedirect.axd in the querystring, you'll need to put "*" in the path config like this:

<add name="JFSRedirect" verb="*" path="*" type="Site.Feature.Journals.Handlers.JfsAuthenticationHandler, Site.Feature.Journals" />

In your code, you can check the querystring for "JFSRedirect.axd" and get out if you can't find it. Continue with your code if you do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.