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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:37:17+00:00 2026-06-05T13:37:17+00:00

I have a controller with a method for downloading file. Without code, all I

  • 0

I have a controller with a method for downloading file. Without code, all I need is to go to this link:

http://localhost:1186/Content/MyFolder/file1.exe

and the file gets downloaded.

I tried to do this with code like this:

Response.Redirect(Server.MapPath("~\\Content\\MyFolder\\file1.exe"));

But the breakpoint passes through this line and nothing happens. I think the problem is I’m using Server.MapPath, but how else would I 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-06-05T13:37:20+00:00Added an answer on June 5, 2026 at 1:37 pm

    you can do something like this

    create an action

    public ActionResult RedirectToDownload()
    {
        return View();
    }
    

    and then on the view with JavaScript on load redirect to your URL

    $(document).ready(function() {
      window.navigate("~/Content/MyFolder/file1.exe");
    });
    

    you might also use this

    public ActionResult Index()
    {
        return Redirect("~/Content/MyFolder/file1.exe");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this controller method: public ActionResult Index(string searchError) { // get all errors
I have a controller method that is a little something like this: def suggestions
My site is open to all but i have a controller with some method
I have written a code for downloading a file(blob in database table).I get a
I have this controller method: public JsonResult List(int number) { var list = new
I have an MVC controller method defined like this: public ActionResult GetPdf(string filename) {
I have a controller method that looks like this: [AcceptGet] public ActionResult Index(SecurityMatrixIndexViewModel model)
I have a controller method CreateOrUpdate, this method is supposed to save the car
I have a controller method in ASP.NET MVC that looks like this: public ActionResult
Assume I have a controller method like this: [Audit] public JsonNetResult List(int start, int

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.