c# - Redirect To Link OnActionExecuting (ActionExecutingContext) -


salaamun alekum want override

controller.onactionexecuting method (actionexecutingcontext)

and inside method want redirectto webpage link how make possible

example:

public class licensefilterattribute : actionfilterattribute {     public override void onactionexecuting(actionexecutingcontext filtercontext)     {         ///some code here         redirect("http://webpage.com"); ///redirect page          ///rest of code 

thank please tell me if require further details

you're close instead of redirect try

filtercontext.result = new redirectresult("http://www.webpage.com"); 

that's use anyways. it's redirecting login page on same project like

filtercontext.result = new redirectresult(url.action("index", "login")); 

edit: removed return statements, it's void , need set redirect result not return it


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -