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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:57:16+00:00 2026-06-10T05:57:16+00:00

I am trying to submit to a controller action method by using Html.ActionLink in

  • 0

I am trying to submit to a controller action method by using Html.ActionLink in my view. I am doing this as non-ajax submit because the return type of my action is FileContentResult (thanks to @Darin for this info). However, my action link is not posting my view to Action Method. Below is my code

View’s Code (Partial view)

@Html.ActionLink("Save", "SaveFile", "ui", new { htmlResult="asdf"}) 

Here, UI is controller name, SaveFile is method name.

Controller method

public FileContentResult SaveFile(string htmlString)
        {
...
...

pdfBytes = pdfConverter.GetPdfBytesFromHtmlString(html);


    var cd = new ContentDisposition

    {
        FileName = "MyFile.pdf",
        Inline = false
    };

    Response.AddHeader("Content-Disposition", cd.ToString());
    return File(pdfBytes, "application/pdf");

}

When I hit the same URL from browser address bar, then it is hit and also returns the pdf file with no issues. Same this is not happening through action link. I also tried putting the action link inside @using Html.BeginForm()…. but no use.

Can you please tell me where I might be doing wrong here?

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-06-10T05:57:17+00:00Added an answer on June 10, 2026 at 5:57 am

    Html.ActionLink has a lots of overloads and it’s very easy to use the wrong one. You are currently using the (String, String, Object, Object) overload which treats your third argument "ui" this route values which leads to a wrongly generated link.

    Use this overload instead:

    @Html.ActionLink("Save", //Link text
                     "SaveFile", // Action Name
                     "ui", // Controller name
                     new { htmlResult="asdf"}, //Route values
                     null /* html attributes */) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to submit a form via ajax to an MVC controller. HTML <%
I'm trying to submit my form to controller using ajax and display ajax response
i'm trying to submit my Ajax form using jQuery. However calling the submit() function
I am trying to submit a form with method GET and action index.php?id=3. The
Trying to rewrite my profile controller wich is broken at this point. Im using
i am trying to submit a form with jQuery to a Spring MVC Controller
I'm trying to submit a form when a select changes using jQuery Mobile. I
I'm trying to submit a few forms through a Python script, I'm using the
I am trying to call Action method passing a single parameter. The method (Accepts
I'm trying to execute my controller from javascript using jquery... here is my jquery

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.