0

I would like to ask if it's possible to model bind querystring parameter in application start up just like in controller's action method? is there any attribute class I can use to make this happen? example:

public ActionResult myMethod(MyModel modelName){
    return View(modelName);
}
3
  • 1
    Why would the application have access to any querystring on startup? Commented Aug 17, 2017 at 17:40
  • 1
    Short answer: No Commented Aug 17, 2017 at 17:42
  • thanks for the response. I just my thought if it's possible so i can get the model on start of post/get request and use it globally around the application. Commented Aug 17, 2017 at 19:19

1 Answer 1

0

in MVC the application start-up defined in RouteConfig :

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Welcome", action = "Index", id = UrlParameter.Optional }
        );
    }

if you want to manipulate param use the id property.

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.