0

I want to call other method or other technique before action call in asp.net mvc 2.

Because I want to set property in variable then to call action in controller.

can any one guide me if possible.

3 Answers 3

2

Does this help http://msdn.microsoft.com/en-us/library/system.web.mvc.actionfilterattribute.onactionexecuting.aspx ?

Sign up to request clarification or add additional context in comments.

Comments

1

You could implement your own controller factory, see here, and do whatever you like with the controller before you return it.

Comments

0

If all you need to do set is set a controller member variable then a quick and clean method is to override the controller's initialize method like so:

protected override void Initialize( RequestContext rc) {
    base.Initialize(rc);
    //Add any variable initialization here
    employeeId = rc.HttpContext.Request.Cookies["userid"]["emp_id"];
}

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.