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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:03:57+00:00 2026-05-27T21:03:57+00:00

I’ve encountered with some strange problem. It’s strange for me because I don’t understand

  • 0

I’ve encountered with some strange problem. It’s strange for me because I don’t understand it and because before everything worked fine. So, my task is to call for controller and pass it file name (with extension) and controller should recognize this file, write into log and then return the file itself if it exists (in Downloads folder). What I’m doing:

public class DownloadController : Controller
{
    public ActionResult Files(string id)
    {
        string filePath = Server.MapPath(Url.Content(string.Format("~/Downloads/{0}", id)));
        string serverPath = Url.Content(string.Format("~/Downloads/{0}", id));
        string ext = Path.GetExtension(filePath);
        if (!System.IO.File.Exists(filePath))
        {
            //return to the error controller
        }
        string mem = "text/html";
        if (ext == ".zip")
        {
            mem = "application/x-zip-compressed";
        }
        else if (ext == ".html" || ext == ".htm")
        {
            mem = "text/html";
        }
        else if (ext == ".pdf")
        {
            mem = "application/pdf";
        }
        //Save info about downloads into DB
        repStat.SaveStatInfo(id, HttpContext.Request.UserHostAddress,
        HttpContext.Request.UserHostName, HttpContext.Request.UserAgent);
        return File(serverPath, mem, id);
    }
}

There is part of the Global.asax:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("Content/{*pathInfo}");

It doesn’t have more “ignores”.

So, the problem is when I’m doing the call: mysite.com/download/files/test.pdf the server returns me “Page not found”. Of course there is no such file in download/files path! It should call for the controller but not the real file. As soon as I delete the extension like mysite.com/download/files/test the server calls for the controller. I don’t understand why it doesn’t recognize the file name just as parameter and tries to find the file.

There is absolutely the same behaviour if I try to do with other controllers – as soon as parameter doesn’t have any extension it works good else the server looks for the file.

The most strange thing is everything works good locally but doesn’t work on the server (worked not tool long but then stopped).

  • 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-27T21:03:58+00:00Added an answer on May 27, 2026 at 9:03 pm

    It looks strange to me too. A workaround would be to encode the dot (.) like, for example,

    test.pdf -> test++pdf
    

    and then decode it then decode it back.

    Probably not the best solution, but will certainly solve the problem.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6

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.