Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 895597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:35:02+00:00 2026-05-15T14:35:02+00:00

I have found 4 or 5 examples of lowercase routes in C# however when

  • 0

I have found 4 or 5 examples of “lowercase routes” in C# however when I use the telerik code converter, I get a bunch of errors.

Namely something to do with "extension methods can be defined only in modules."

Does anyone have any good resources on how to map routes to lowercase in VB?

EDIT:

here is an example of some converted code that is erroring

Imports System
Imports System.Web.Mvc
Imports System.Web.Routing

Namespace MyMvcApplication.App.Helpers
    Public Class LowercaseRoute
        Inherits System.Web.Routing.Route
        Public Sub New(ByVal url As String, ByVal routeHandler As IRouteHandler)
            MyBase.New(url, routeHandler)
        End Sub
        Public Sub New(ByVal url As String, ByVal defaults As RouteValueDictionary, ByVal routeHandler As IRouteHandler)
            MyBase.New(url, defaults, routeHandler)
        End Sub
        Public Sub New(ByVal url As String, ByVal defaults As RouteValueDictionary, ByVal constraints As RouteValueDictionary, ByVal routeHandler As IRouteHandler)
            MyBase.New(url, defaults, constraints, routeHandler)
        End Sub
        Public Sub New(ByVal url As String, ByVal defaults As RouteValueDictionary, ByVal constraints As RouteValueDictionary, ByVal dataTokens As RouteValueDictionary, ByVal routeHandler As IRouteHandler)
            MyBase.New(url, defaults, constraints, dataTokens, routeHandler)
        End Sub

        Public Overrides Function GetVirtualPath(ByVal requestContext As RequestContext, ByVal values As RouteValueDictionary) As VirtualPathData
            Dim path As VirtualPathData = MyBase.GetVirtualPath(requestContext, values)

            If path IsNot Nothing Then
                path.VirtualPath = path.VirtualPath.ToLowerInvariant()
            End If

            Return path
        End Function
    End Class

    Public NotInheritable Class RouteCollectionExtensions
        Private Sub New()
        End Sub
        <System.Runtime.CompilerServices.Extension()> _
        Public Shared Sub MapRouteLowercase(ByVal routes As RouteCollection, ByVal name As String, ByVal url As String, ByVal defaults As Object)
            routes.MapRouteLowercase(name, url, defaults, Nothing)
        End Sub

        <System.Runtime.CompilerServices.Extension()> _
        Public Shared Sub MapRouteLowercase(ByVal routes As RouteCollection, ByVal name As String, ByVal url As String, ByVal defaults As Object, ByVal constraints As Object)
            If routes Is Nothing Then
                Throw New ArgumentNullException("routes")
            End If

            If url Is Nothing Then
                Throw New ArgumentNullException("url")
            End If

            Dim route = New LowercaseRoute(url, New MvcRouteHandler()) With { _
             .Defaults = New RouteValueDictionary(defaults), _
             .Constraints = New RouteValueDictionary(constraints) _
            }

            If [String].IsNullOrEmpty(name) Then
                routes.Add(route)
            Else
                routes.Add(name, route)
            End If
        End Sub
    End Class
End Namespace
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:35:03+00:00Added an answer on May 15, 2026 at 2:35 pm

    To solve your “extension methods can be defined only in modules.” problem:
    Change “NotInheritable class” where you defined those methods to “Module” and remove the constructor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found several examples using datamapper and was able to get them to
I have done some research, and majority of the examples I have found use
I have found examples of how to fork multiple children by having something like
I have found numerous examples on uploading a file to a web server via
I have found various examples of using jquery to wrap selected text from a
I wish to send text between processes. I have found lots of examples of
I have found the example of using the local sockets . The code from
How do you load a picture into smalltalk? I have found several examples of
Is this even possible without calling a specific package? I have found countless examples
Firstly, I have found many examples of how to grab data from a db

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.