From: Dmitri Vaganov on 28 May 2010 10:40 Hello I created custom URL routing in ASP.NET 3.5 (http://blogs.msdn.com/b/mikeormond/archive/2008/05/14/using-asp-net-routing-independent-of-mvc.aspx), but my AJAX code is giving me error now: 'Sys' is undefined. When I remove the routing, AJAX works fine. I am using standard Microsoft AJAX libraries. Please help!
From: gerry on 28 May 2010 11:56 this happens when you have wildcarding in place one way to solve this to add a constraint to your routes so they only work for .aspx , ... files - something like this : RouteValueDictionary constraints = new RouteValueDictionary( new { Page = @".*\.aspx*$" } ); Route rt = new Route( "{Page}" , RouteHandler ); rt.Constraints = constraints; routes.Add( "RouteHandler" , rt ); "Dmitri Vaganov" <DmitriVaganov(a)discussions.microsoft.com> wrote in message news:3AEB12F3-1C34-401B-B605-63B062FAF341(a)microsoft.com... > Hello I created custom URL routing in ASP.NET 3.5 > (http://blogs.msdn.com/b/mikeormond/archive/2008/05/14/using-asp-net-routing-independent-of-mvc.aspx), > but my AJAX code is giving me error now: 'Sys' is undefined. When I remove > the routing, AJAX works fine. I am using standard Microsoft AJAX > libraries. > Please help! >
From: Dmitri Vaganov on 1 Jun 2010 14:50 Thanks for your help, Gerry. When I add the constraint, the Routing stops redirecting to the page that I specified. When I remove constraint it works fine. Here is my routing code: RouteValueDictionary constraints = new RouteValueDictionary(new { Page = @".*\.aspx*$" }); Route rt = new Route("{Page}", new CustomRouteHandler("~/WelcomePage.aspx")); rt.Constraints = constraints; routes.Add("RouteHandler", rt); Here is CustomRouteHandler: public class CustomRouteHandler : IRouteHandler { public CustomRouteHandler(string virtualPath) { this.VirtualPath = virtualPath; } public string VirtualPath { get; private set; } public IHttpHandler GetHttpHandler(RequestContext requestContext) { foreach (var urlParm in requestContext.RouteData.Values) { requestContext.HttpContext.Items[urlParm.Key] = urlParm.Value; } var page = BuildManager.CreateInstanceFromVirtualPath (VirtualPath, typeof(Page)) as IHttpHandler; return page; } } "gerry" wrote: > this happens when you have wildcarding in place > one way to solve this to add a constraint to your routes so they only work > for .aspx , ... files - something like this : > > RouteValueDictionary constraints = new RouteValueDictionary( new { Page = > @".*\.aspx*$" } ); > Route rt = new Route( "{Page}" , RouteHandler ); > rt.Constraints = constraints; > routes.Add( "RouteHandler" , rt ); > > > "Dmitri Vaganov" <DmitriVaganov(a)discussions.microsoft.com> wrote in message > news:3AEB12F3-1C34-401B-B605-63B062FAF341(a)microsoft.com... > > Hello I created custom URL routing in ASP.NET 3.5 > > (http://blogs.msdn.com/b/mikeormond/archive/2008/05/14/using-asp-net-routing-independent-of-mvc.aspx), > > but my AJAX code is giving me error now: 'Sys' is undefined. When I remove > > the routing, AJAX works fine. I am using standard Microsoft AJAX > > libraries. > > Please help! > > > > > . >
From: Dmitri Vaganov on 1 Jun 2010 15:32 Gerry, I added a custom constraint class to catch the pages with "." in the name. That fixed the issue. Thanks for all your help!!! "gerry" wrote: > this happens when you have wildcarding in place > one way to solve this to add a constraint to your routes so they only work > for .aspx , ... files - something like this : > > RouteValueDictionary constraints = new RouteValueDictionary( new { Page = > @".*\.aspx*$" } ); > Route rt = new Route( "{Page}" , RouteHandler ); > rt.Constraints = constraints; > routes.Add( "RouteHandler" , rt ); > > > "Dmitri Vaganov" <DmitriVaganov(a)discussions.microsoft.com> wrote in message > news:3AEB12F3-1C34-401B-B605-63B062FAF341(a)microsoft.com... > > Hello I created custom URL routing in ASP.NET 3.5 > > (http://blogs.msdn.com/b/mikeormond/archive/2008/05/14/using-asp-net-routing-independent-of-mvc.aspx), > > but my AJAX code is giving me error now: 'Sys' is undefined. When I remove > > the routing, AJAX works fine. I am using standard Microsoft AJAX > > libraries. > > Please help! > > > > > . >
|
Pages: 1 Prev: Is an internet connection required Next: Version control and the GAC |