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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:39:11+00:00 2026-05-20T06:39:11+00:00

how I can create something like this: Html.MyApp.ActionLink()? Thanks.

  • 0

how I can create something like this: Html.MyApp.ActionLink()?
Thanks.

  • 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-20T06:39:12+00:00Added an answer on May 20, 2026 at 6:39 am

    You can’t do this. The only way you can add to the Html class is via an extension method. You cannot add "Extension Properties", which is what would be required for you to use Html.MyApp. The closest you could come is Html.MyApp().Method(...)

    Your best bet is probably to either include them as extension methods on Html, or create a new class completely (eg. MyAppHtml.Method(...) or MyApp.Html.Method(...)). There was a blog post around recently specifically showing an "Html5" class with these methods, but unfortunately my Google skills are failing me, and I can’t find it 🙁

    Added 13 Oct 2011 as asked in comment

    To do something like Html.MyApp().ActionLink() you need to create an extension method on HtmlHelper, that returns an instance of a class with your custom method:

    namespace MyHelper
    {
        public static class MyHelperStuff
        {
            // Extension method - adds a MyApp() method to HtmlHelper
            public static MyHelpers MyApp(this HtmlHelper helper)
            {
                return new MyHelpers();
            }
        }
    
        public class MyHelpers
        {
            public IHtmlString ActionLink(string blah)
            {
                // Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
                return new MvcHtmlString(string.Format("<a href=\"#\">{0}</a>", HttpUtility.HtmlEncode(blah)));
            }
        }
    }
    

    Note: You’ll need to import the namespace this class is in in Web.config, like this:

    <?xml version="1.0"?>
    <configuration>
        <system.web.webPages.razor>
            <pages>
                <namespaces>
                    <add namespace="MyHelper"/>
                </namespaces>
            </pages>
        </system.web.webPages.razor>
    </configuration>
    

    The change in the Web.Config file needs to be done in the config file for the view, not the global one

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

Sidebar

Related Questions

I used to have something like this: We suggest you read our @Html.ActionLink(help page,
Can I create something like an Internet Explorer accelerator using JavaScript on the client-side?
I have a partial view that has something like this <%= Html.DropDownListFor(m => m.SelectedProductName,
I am querying an HTML file with LINQ-to-XML. It looks something like this: <html>
I'm using django templates to create an e-mail. I do something like this: msg_html
I am fairly new to html/css and need to create something like the following:
I'd like to create a webpage which looks like this: https://i.stack.imgur.com/GYEis.png I can't use
I'm for years using something like this in my HTML for elements which should
How can create a view with mutiple images, something similiar to the photo app
How can I create a barcode image in Java? I need something that will

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.