//*************************************************************************************************************************************** /// <summary> /* * * This method implements the loading of all URLs patterns that contain file extensions that need to be ignored and * all URLs patterns that need to be processed: * * * Example of patterns to process: * routes.Add("ProfilesAliasPath2", new Route("{Param0}/{Param1}/{Param2}", new ProfilesRouteHandler())); * The above example will register a URL pattern for processing by the Alias.aspx page. When IIS makes a request, * the URL pattern of http://domain.com/profile/person/32213, will trigger the .Net System.Web.Routing library to call ProfilesRouteHandler.GetHttpHandler(RequestContext requestContext){}. This method will process the URL pattern into parameters and load the HttpContext.Current.Items hash table and then direct the request to the Alias.aspx page for processing. * */ /// </summary> /// <param name="routes">RouteTable.Routes is passed as a RouteCollection by ref used to store all routes in the routing framework.</param> private static void RegisterRoutes(RouteCollection routes) { Framework.Utilities.DataIO d = new Framework.Utilities.DataIO(); //The REST Paths are built based on the applications setup in the Profiles database. using (System.Data.SqlClient.SqlDataReader reader = d.GetRESTApplications()) { int loop = 0; routes.RouteExistingFiles = false; // by UCSF routes.Add("RobotsTxt", new Route("robots.txt", new AspxHandler("~/RobotsTxt.aspx"))); routes.Add("SiteMap", new Route("sitemap.xml", new AspxHandler("~/SiteMap.aspx"))); while (reader.Read()) { routes.Add("ProfilesAliasPath0" + loop, new Route(reader[0].ToString(), new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath1" + loop, new Route(reader[0].ToString() + "/{Param1}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath2" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath3" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath4" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath5" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath6" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath7" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath8" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}/{Param8}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath9" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}/{Param8}/{Param9}", new ProfilesRouteHandler())); Framework.Utilities.DebugLogging.Log("REST PATTERN(s) CREATED FOR " + reader[0].ToString()); loop++; } } }
//*************************************************************************************************************************************** /// <summary> /* This method implements the loading of all URLs patterns that contain file extensions that need to be ignored and all URLs patterns that need to be processed: Example of patterns to process: routes.Add("ProfilesAliasPath2", new Route("{Param0}/{Param1}/{Param2}", new ProfilesRouteHandler())); The above example will register a URL pattern for processing by the Alias.aspx page. When IIS makes a request, the URL pattern of http://domain.com/profile/person/32213, will trigger the .Net System.Web.Routing library to call ProfilesRouteHandler.GetHttpHandler(RequestContext requestContext){}. This method will process the URL pattern into parameters and load the HttpContext.Current.Items hash table and then direct the request to the Alias.aspx page for processing. */ /// </summary> /// <param name="routes">RouteTable.Routes is passed as a RouteCollection by ref used to store all routes in the routing framework.</param> private static void RegisterRoutes(RouteCollection routes) { Framework.Utilities.DataIO d = new Framework.Utilities.DataIO(); System.Data.SqlClient.SqlDataReader reader; //The REST Paths are built based on the applicaitons setup in the Profiles database. reader = d.GetRESTApplications(); int loop = 0; routes.RouteExistingFiles = false; // by UCSF routes.Add("RobotsTxt", new Route("robots.txt", new RobotsTxtHandler())); routes.Add("SiteMap", new Route("sitemap.xml", new SiteMapHandler())); while (reader.Read()) { routes.Add("ProfilesAliasPath0" + loop, new Route(reader[0].ToString(), new ProfilesRouteHandler())); // do not want to add these others for non pretty names if (!reader[0].ToString().Contains(".")) { routes.Add("ProfilesAliasPath1" + loop, new Route(reader[0].ToString() + "/{Param1}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath2" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath3" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath4" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath5" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath6" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath7" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath8" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}/{Param8}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath9" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}/{Param8}/{Param9}", new ProfilesRouteHandler())); } Framework.Utilities.DebugLogging.Log("REST PATTERN(s) CREATED FOR " + reader[0].ToString()); loop++; } if (!reader.IsClosed) reader.Close(); }
//*************************************************************************************************************************************** /// <summary> /* This method implements the loading of all URLs patterns that contain file extensions that need to be ignored and all URLs patterns that need to be processed: Example of patterns to process: routes.Add("ProfilesAliasPath2", new Route("{Param0}/{Param1}/{Param2}", new ProfilesRouteHandler())); The above example will register a URL pattern for processing by the Alias.aspx page. When IIS makes a request, the URL pattern of http://domain.com/profile/person/32213, will trigger the .Net System.Web.Routing library to call ProfilesRouteHandler.GetHttpHandler(RequestContext requestContext){}. This method will process the URL pattern into parameters and load the HttpContext.Current.Items hash table and then direct the request to the Alias.aspx page for processing. */ /// </summary> /// <param name="routes">RouteTable.Routes is passed as a RouteCollection by ref used to store all routes in the routing framework.</param> private static void RegisterRoutes(RouteCollection routes) { Framework.Utilities.DataIO d = new Framework.Utilities.DataIO(); //The REST Paths are built based on the applications setup in the Profiles database. using (System.Data.SqlClient.SqlDataReader reader = d.GetRESTApplications()) { int loop = 0; routes.RouteExistingFiles = false; // by UCSF routes.Add("RobotsTxt", new Route("robots.txt", new AspxHandler("~/RobotsTxt.aspx"))); routes.Add("SiteMap", new Route("sitemap.xml", new AspxHandler("~/SiteMap.aspx"))); while (reader.Read()) { routes.Add("ProfilesAliasPath0" + loop, new Route(reader[0].ToString(), new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath1" + loop, new Route(reader[0].ToString() + "/{Param1}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath2" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath3" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath4" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath5" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath6" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath7" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath8" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}/{Param8}", new ProfilesRouteHandler())); routes.Add("ProfilesAliasPath9" + loop, new Route(reader[0].ToString() + "/{Param1}/{Param2}/{Param3}/{Param4}/{Param5}/{Param6}/{Param7}/{Param8}/{Param9}", new ProfilesRouteHandler())); Framework.Utilities.DebugLogging.Log("REST PATTERN(s) CREATED FOR " + reader[0].ToString()); loop++; } } }