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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:26:44+00:00 2026-05-18T00:26:44+00:00

Folks, We are trying to use the strongly typed action link methods that look

  • 0

Folks,

We are trying to use the strongly typed action link methods that look like this:

Html.ActionLink<HomeController>

in the Razor view engine.

I know we shouldn’t use them all the time because it ignores filters, etc., but the fact is we do use them.

If I try to use this directly in Razor like so:

@Html.ActionLink<HomeController>(c => c.Index, "Home")

I get an error of:

CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

If you look at the compiled code, it’s because Razor is not parsing that statement as you would expect. The compiled source, from the error that has the line looks like this:

...
Line 101:              #line 13 "C:\dev\TheNetwork\POC\Web\Views\Policy\Edit.cshtml"
Line 102:  Write(Html.ActionLink);
Line 103:  
Line 104:              
Line 105:              #line default
Line 106:              #line hidden
Line 107:  WriteLiteral("<PolicySectionController>(c => c.Edit(null), "New\")\r\n\r\n\r\n\r\n");

Much stuff omitted for brevity 🙂 As you can see, it splits it on the “<” I think it’s interpreting that as an HTML tag, but I can’t be sure.

I found a workaround, but it’s ugly. This works:

@{Write(Html.ActionLink<PolicySectionController>(c => c.Edit(null), "New"));}

Does anyone know of a better way to do this?

  • 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-18T00:26:45+00:00Added an answer on May 18, 2026 at 12:26 am

    Yeah, in order to use generic methods you need to escape the expression using parens. Would this work:

    @(Html.ActionLink<PolicySectionController>(c => c.Edit(null), "New"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Folks, I am trying to use Team City. I completed the six steps out
I am querying an HTML file with LINQ-to-XML. It looks something like this: <html>
By now most folks on this site are probably aware that: $("#someTable TD.foo").click(function(){ $(e.target).doSomething();
I'm trying to understand how strategies some folks use to distinguish instance vars vs.
I'm trying to figure out a Java regex problem that I'm having. This is
Folks, There is so much info out there on HTML::Treebuilder that I'm surprised I
I am trying to use http://studio.html5rocks.com/samples/slides/index.html for a website. While it works perfectly in
I am trying to use This PHP Mail form, http://jemsmailform.com/ and I keep getting
Hey folks I am trying to implement a search functionality in a website using
Folks, I am trying to display EXT JS with Row Expander plugin in a

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.