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 6872049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:52:46+00:00 2026-05-27T03:52:46+00:00

Using VB.NET with MVC3 and Razor. I have a test page for a custom

  • 0

Using VB.NET with MVC3 and Razor.

I have a test page for a custom extension to htmlhelper. Visual Studio tells me the view is not ok :

code of index.vbhtml (view)

<h2>@ViewData("Message")</h2>

@Html.CustomLink("text 321312", 123)

Error : CustomLink is not a member of System.Web.Mvc.HtmlHelper(..)

code of LinkExtension.vb (extension)

Imports System.Runtime.CompilerServices
Imports System.Web.Mvc

Public Module htmlHelperExtensions
    <Extension()> _
    Public Function CustomLink(htmlHelper As HtmlHelper, linkText As String, uuid As Short) As MvcHtmlString
        Return MvcHtmlString.Create(String.Format("<a href="#{1}">{0}</a>", linkText, uuid )
    End Function
End Module

web.config (added namespace)

I added a reference to my librairy in both general web.config and view web.config
(I also tried to add it to the controller.)

<system.web>
  <pages>
    <namespaces>
      [...]
      <add namespace="linkExtension" />
    </namespaces>
  </pages>
</system.web>

The page run correctly and build the html as I need it. But VS keeps telling me the code is not right (CustomLink is not a member of ‘System.Web.HtmlHelper(Of Object)’)! Any ideas?

  • 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-27T03:52:46+00:00Added an answer on May 27, 2026 at 3:52 am

    Try specifying the project when adding the namespace:

    <add namespace="MyProject.linkExtension" />
    

    If you’re unsure what it is, locate the project where your htmlHelperExtensions is, right-click it in the Solution Explorer, select Properties, and on the Application tab use the value under the “Root namespace” label.

    Also, your code doesn’t show the usage of Namespace linkExtension defined in the extension file, so if the above doesn’t work try adding it to your module:

    Namespace linkExtension
        Public Module htmlHelperExtensions
            <Extension()> _
            Public Function CustomLink(htmlHelper As HtmlHelper, linkText As String, uuid As Short) As MvcHtmlString
                Return MvcHtmlString.Create(String.Format("<a href="#{1}">{0}</a>", linkText, uuid )
            End Function
        End Module
    End Namespace
    

    If that doesn’t help then what version of MVC are you running on? A similar issue was reported by someone also using VB.NET. In that person’s case they got it working when upgrading all their projects to MVC 3, or uninstalling MVC 3 since they were using MVC 2. Apparently there was also some interference with having SP1 and Azure Tools installed.

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

Sidebar

Related Questions

I had created a webpage using asp.net mvc3 razor. I have two master pages
I have a string created using asp.net MVC3 Razor block like this: @{ var
I am using ASP.NET MVC 3 with the Razor view engine . I have
I have an href in my asp.net MVC3 Razor view and I want to
Here's the issue at hand: I have developed an ASP.NET MVC3 application using Razor.
I have an asp.net mvc3 Razor app being developed in VS2010 using Git for
I have an existing SqlConnection conn; in some controller (using ASP.NET MVC3 + Razor
I have created a link for deletion in asp.net mvc3 razor view like this:
I have something like this in Site.Master in an asp.net mvc3 (not razor) project:
Using Telerik MVC3 grid, C#, .Net 2010; I have a grid in my razor

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.