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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:32:01+00:00 2026-05-28T23:32:01+00:00

I am learning MVC 3 after hours right now and last night I ran

  • 0

I am learning MVC 3 after hours right now and last night I ran into an issue that seems like it would be very simple to solve but I can’t seem to locate a solution for it.

I have a simple contact form. The end user fills out the form and submits it. When they submit the form I redirect the end user to a different action in the same controller which renders an “inquiry submitted” page/view which is basically a “Thank you page”.

The controller is setup like so.

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

[HttpPost]
public ActionResult ContactUs(ContactInfo contactInfo)
{
     if (!ModelState.IsValid)
     {
          return View();
     }

     //perform some business logic

     return RedirectToAction("InquirySubmitted",contactInfo);


}

 public ActionResult InquirySubmitted(ContactInfo contactInfo)
 {
    return View(contactInfo);
 }

The problem:
I do not want end users navigating directly to the InquirySubmitted action via the browser.
I only want the ContactUs action in the controller to be able to send users to the InquirySubmitted View.

I have attempted to make the InquirySubmitted action private so that only the controller can call it like so:

private ActionResult InquirySubmitted(ContactInfo contactInfo)

But this produces an error which I fully understand because I am forcing the browser to request InquirySubmitted by using RedirectToAction().

So my question is simply: What is the best “MVC 3 style” solution to this issue.

  • 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-28T23:32:02+00:00Added an answer on May 28, 2026 at 11:32 pm

    You will need to put logic in your InquirySubmitted ActionResult in order to prevent users from viewing the page if they are not supposed to.

    You are already passing the InquirySubmitted method your model (ContactInfo). Could you simply inspect the data passed to the method and if it is absent then redirect the user to an error page (or some other page of your choice)?

    An alternate solution would be to set a boolean in session that indicates that the user completed the “ContactUs” form. Then you could check for that session object within InquirySubmitted.

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

Sidebar

Related Questions

I am learning ASP.NET MVC now a days and I have found that most
I'm learning asp.net mvc and found something interesting: It seems that I can't explicitly
I am just learning MVC and I've created a form but I would like
Started learning Wicket after ASP.NET MVC and feel a little bit confused about managing
I am learning MVC from Stephen Walther tutorials on MSDN website. He suggests that
Hi I am learning Ajax + MVC. I figured it would be nice for
I am staring to get used to MVC and after a couple little learning
I'm just learning MVC and have a question that I'm sure is obvious to
I'm learning MVC 4, and it's my understanding that going to this URL should
I'm in the process of learning Asp.Net MVC after coming off my WPF background.

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.