System.Web.HttpResponse.RedirectToRoute C# (CSharp) Method

RedirectToRoute() private method

private RedirectToRoute ( string callerName, string routeName, RouteValueDictionary routeValues, int redirectCode, bool endResponse ) : void
callerName string
routeName string
routeValues RouteValueDictionary
redirectCode int
endResponse bool
return void
		void RedirectToRoute (string callerName, string routeName, RouteValueDictionary routeValues, int redirectCode, bool endResponse)
		{
			HttpContext ctx = context ?? HttpContext.Current;
			HttpRequest req = ctx != null ? ctx.Request : null;
			
			if (req == null)
				// Let's emulate .NET
				throw new NullReferenceException ();
			
			VirtualPathData vpd = RouteTable.Routes.GetVirtualPath (req.RequestContext, routeName, routeValues);
			string redirectUrl = vpd != null ? vpd.VirtualPath : null;
			if (String.IsNullOrEmpty (redirectUrl))
				throw new InvalidOperationException ("No matching route found for RedirectToRoute");

			Redirect (redirectUrl, true, redirectCode);
		}

Same methods

HttpResponse::RedirectToRoute ( RouteValueDictionary routeValues ) : void
HttpResponse::RedirectToRoute ( object routeValues ) : void
HttpResponse::RedirectToRoute ( string routeName ) : void
HttpResponse::RedirectToRoute ( string routeName, RouteValueDictionary routeValues ) : void
HttpResponse::RedirectToRoute ( string routeName, object routeValues ) : void

Usage Example

 public void popupHandler(string campaignCustomerUuid, HttpResponse response)
 {
     response.RedirectToRoute(new
     {
         controller = "Home",
         action = "HandleMigrationPopup",
         campaignCustomerUuid
     });
 }
All Usage Examples Of System.Web.HttpResponse::RedirectToRoute