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

  • Home
  • SEARCH
  • 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 535557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:43:45+00:00 2026-05-13T09:43:45+00:00

In my global.asax.cs file. I add an entry routes.MapRoute( Static text, Static/General/{filePath}, new {

  • 0

In my global.asax.cs file. I add an entry

       routes.MapRoute(
            "Static text",
            "Static/General/{filePath}",
            new { controller = "Static", Action = "General", filePath = "" },
          //  new { filePath = @"xxxx" } // greedy regular expression
        );

What I want to do is to take the content from the static files and insert into my view pages. This map works fine if my filePath is in the root such as 1.txt. But it won’t work if the file is located in some sub directory such as staticfiles/1.txt. Because the routing module will consider “staticfiles” as the filePath and leave the “1.txt” as some other parameter. I know what I need to do is applying some regular expression trick on the filePath parameter. But I couldn’t figure out how to make the regex engine to read all the way to end of url. Can someone show me the trick I should apply? Thanks very much.

  • 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-13T09:43:46+00:00Added an answer on May 13, 2026 at 9:43 am

    Try putting an asterix before filePath:

    routes.MapRoute(
        "Static text",
        "Static/General/{*filePath}",
        new { controller = "Static", Action = "General", filePath = "" }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Global.asax file on Application_Start I create a certain number of routes in
If I register the HandleError attribute in global.asax.cs file as below, public static void
I'm trying to query a database from the Application_BeginRequest in my Global.asax file to
I have 2 test and 1 production server. In my global.asax file - I
I can't capture what is happening here. My global.asax file has nothing exotic in
I upgraded my website from .NET 1.1 to .NET 4.0. In my Global.asax.vb file
global.asax: var desktopJsBundle = new Bundle(~/desktop-js-bundle, new JsMinify()); desktopJsBundle.AddFile(~/scripts/jquery-1.7.1.min.js); desktopJsBundle.AddFile(~/scripts/test.js); BundleTable.Bundles.Add(desktopJsBundle); layout.cshtml: <script src=@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl(~/desktop-js-bundle)></script>
In my global.asax.vb I have a rule like so: RouteTable.Routes.MapPageRoute(defaultRoute, {*value}, ~/default.aspx) So, if
Does the Application_Start in global.asax called when the new published code is kept in
In my Global.ASAX file i have the following: void Session_End(object sender, EventArgs e) {

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.