2

I am reading some existing code in a project and there are some custom handlers that validate some data on application pages.

The question is: Does these HTTPHandler get executed for every simple HTTP Request on the entire sharepoint farm? or just for a single web app?

The code validates some information from custom field types,

public void ProcessRequest(HttpContext context)
        {
            try
            {
                if (GeneralUtilities.ControlQueryString(context))
                {
                    string incomminginformation = context.Request.QueryString[ApplicationResources.QuerystringParameters.ClientCode].ToString();
                    string[] data = null;

                    //When we press the save button and the job is not correct the client will
                    //not be validted beacause its diplayed in an other way.
                    if (incomminginformation.Contains(" - "))
                    {
                        data = incomminginformation.Split('-');
                        string tmp = data[0].Trim();
                        if (tmp.Trim().Length == 8)
                            incomminginformation = tmp;
                    }

I also noticed the handlers are somehow called by jquery like this:

if (lenght == 8) {
        $.ajax({
            url: "_layouts/15/xx/xx/GenericHandlers/xx.ashx?clientcode=" + currentvalue,
            type: "POST",
2

The handler fires when called - sorry, I misread your question. I mentally replaced HTTPHandler with IIS Module.

Old: The httphandlers are registered in the web.config of a Web Application. If only registered in one Web Application it fires only for that one.

| improve this answer | |
  • so, this code will be executed for every single request on that web application? – Luis Valencia May 27 '13 at 10:17
  • 1
    please check my edit, I noticed there is some jquery that references or uses the ashx files, I guess the handlers will only be used when that jquery code is called, not for all htpp requests in the web application? – Luis Valencia May 27 '13 at 10:18

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.