From: Dmitri Vaganov on
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
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
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
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!
> >
>
>
> .
>