0

I want to capture the query string code "?CODE=" which could be append to various links and this links will be used in the advertisements on other websites.

www.TestProject.com/Home?Code=ASCD

www.TestProject.com/FAQ?Code=ASCD2

www.TestProject.com/Tips?Code=ASCD3

So when the user clicks on this link the code will be captured and saved in a cookie. And if the user registers on the site then the code will be linked with his registration ID.

I have written the code in a static helper class to capture the URL. I make a call to this method from all the controller/Action Methods.

I wanted to know if this is the correct approach or should i call this method in Global.asax Application_BeginRequest() Method.

1 Answer 1

2

I would create a custom ActionFilterAttribute.

You can use it to mark certain actions, controllers, or you can register it for all the actions in your website

protected void Application_Start()
{
    //...
    GlobalFilters.Filters.Add(new MvcProfilerGlobalAttribute());
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.