Q:

ASP.NET webforms 4.5 MapPageRoute Route Constraint w/ regex not working

I am trying to get a route constraint to work with a GUID in the path to route using REGEX, and can't see where I am going wrong. 
The url is re-routed to the correct page, but the regex is completely ignored (I can put any garbage in and it matches everything). 
Here's the code: (NOTE- this is NOT MVC but webforms on ASP.Net 4.5)
Imports System. Web. Routing
Imports Microsoft. AspNet. FriendlyUrls

Public Module RouteConfig
Sub RegisterRoutes(ByVal routes As RouteCollection)
    routes. EnableFriendlyUrls()

    Dim guidRegex As String = "^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$"
    routes. MapPageRoute("Redirect", "r/{lid}", "~/redirect.aspx", True, New RouteValueDictionary(New With {.lid = guidRegex}))
End Sub

End Module

I've tried this technique with other regular expressions (with examples copied straight off the Microsoft site) and it does not work either. 
There's something I'm doing wrong, but I can't figure it out. 

A:

I know this is almost 2.5 years later, and I apologize for the delay in answering you...however, I  just tried routes for the first time in ASP.Net 4.5 webforms today, and as a result I just stumbled upon your answer today.  So I'm posting it in the event that someone else (e.g. me the next time I come across the situation) finds it useful. 
The reason your regular expressions weren't working is that you're missing something that was included in the Microsoft example...the defaults.  The MapPageRoute method actually contains up to six parameters: the name, the URL pattern, the physical file, whether or not you want to check to see if the file exists, the defaults, and the constraints.) 
In the case of your example above, your regular expression is being applied as a default, not a constraint as you might have expected; this is what threw me for about 2.5 hours.  So, in order to get your example to work, you need to add defaults.  Since you don't have any defaults, you can add Nothing and it will work. 
Using your example, and modifying the one line:
Imports System. Web. Routing
Imports Microsoft. AspNet. FriendlyUrls

Public Module RouteConfig
Sub RegisterRoutes(ByVal routes As RouteCollection)
    routes. EnableFriendlyUrls()

    Dim guidRegex As String = "^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$"
    routes. MapPageRoute("Redirect", "r/{lid}", "~/redirect.aspx", True, Nothing, New RouteValueDictionary(New With {.lid = guidRegex}))
End Sub

End Module

Thus, your answer is...quite literally...nothing.