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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:03:54+00:00 2026-05-16T06:03:54+00:00

I have a Visitors controller. Inside I have Index and SignIn actions. Here are

  • 0

I have a Visitors controller. Inside I have Index and SignIn actions. Here are the actions:

  public ActionResult Index(int month,
                              int day,
                              int year){

        var visitors = visitorRepoistory.FindVisitorsByDate(month, day, year).ToList();

        return View("Index", visitors);
    }

    [HttpPost]
    public ActionResult SignIn(Visitor visitor) {
        if (ModelState.IsValid) {
            visitorRepoistory.Add(visitor);
            visitorRepoistory.Save();
            return RedirectToAction("/", new { month = DateTime.Now.Month, day = DateTime.Now.Day, year = DateTime.Now.Year });
        } else {
            return View(new VisitorFormViewModel(visitor));
        }
    }

More specifically, I’m trying to understand the RedirectToAction() in SignIn(). I would like to have it redirect to my index action and have the url look like: …/08/10/2010, but instead I get: ?month=8&day=10&year=2010. How can I fix this?

Thanks.

Update
Here is my route (When hardcoded in the url it works):

 routes.MapRoute(
            "VisitorsByDate", // Route name
            "{controller}/{month}/{day}/{year}", // URL with parameters
            new { controller = "visitors", action = "index"}, // Parameter defaults
            new { month = @"\d{2}", day = @"\d{2}", year = @"\d{4}" }
        );
  • 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-16T06:03:54+00:00Added an answer on May 16, 2026 at 6:03 am

    Do you have a route that matches these values to route values? If you do not have a matching route, .NET MVC will show your parameters in the old school(??) format and not within a nice path like /home/blog/8/10/2010

    routes.MapRoute("Visitor_Routes",  
                    "{controller}/{action}/{month}/{day}/{year}", 
                    new {  
                          controller = "Blog", 
                          action = "archive", 
                          year = Urlparameter.Optional, 
                          month = Urlparameter.Optional, 
                          day = Urlparameter.Optional
                        }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of IP addresses of visitors to my site, what tools can
I have a website where i want my visitors to invite their friends. I'm
I have a website on which visitors can use a send to a friend
I have a MYSQL table with all of the visitors to my website. Each
I have an php website with login form and I want every visitors can
I have spent quite some time going through similar questions here and have not
I have a Yii Powered web app with a controller (PostController) and a view
Lately I have seen this in my error log (1 per day, and I
and thanks for taking the time to read my question. We will have visitors
I have the following ajax call: $(#welcome a.close).click(function(e) { $.ajax({ type: GET, url: /visitors/hide_welcome,

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.