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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:51:50+00:00 2026-05-12T08:51:50+00:00

Basically I have a bunch of submission forms that gather data in a generic

  • 0

Basically I have a bunch of submission forms that gather data in a generic way -> serialize the input / value pairs to a CSV file. I’d like to add new submission pages without having to write a new controller action (the idea being I wouldn’t have to compile and deploy a new assembly). So, here’s my thinking:

http://foobar.com/Submission/Contact
http://foobar.com/Submission/Apply

both should route to the SubmissionController.Handle() method. The Handle method will show the view for the appropriate action:

return View("Contact");
// or
return View("Apply");

The views would both have their form’s actions as “/Submission/Handle” and the controller would have:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Handle(FormCollection inputs)

So a) how do I route both the actions Contact and Apply to Handle and b) how do I query from within the SubmissionController for the action name so I can do:

var viewName = GetActionName();
return View(viewName);

Obviously I’m a n00b to ASP.NET MVC … so if there’s a better method, please let me know.

  • 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-12T08:51:50+00:00Added an answer on May 12, 2026 at 8:51 am

    You would have to write a custom route.
    For example, in global.asax before the default route:

    // Submission/*
    routes.MapRoute(
          "Submission",
          "Submission/{method}", 
          new { controller = "Submission", action = "Handle", method = "" }
          );
    

    You can add anything within brackets, and that will be the key to the route’s value in the RouteValueDictionary. Note that controller and action are conventions used within ASP.NET MVC.

    The way you have it stated:
    To access this new key called ‘method’ in your controller, you’d do something like:

    string methodName = RouteData.Values["method"];
    

    Then, I guess do a switch for each of your methods.

    Perhaps and easier way:
    Instead of doing a swtich to return a specific view, what I’d do is:

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Handle(FormCollection inputs)
        {
            ViewData["method"] = RouteData.Values["method"];
    
            return View();
        }
    

    add the methodName to ViewData. and return the HandleView. Then, create a partial for each form type. In the HandleView, put:

    <% Html.RenderPartial(ViewData["method"]); %>
    

    That way, you don’t have a bunch of hard-coded routes to handle. But, you’ll have to handle errors and incorrect methods being passed to the route.

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

Sidebar

Related Questions

So basically, I have a bunch of TextBoxes that the user gets to fill
I have a page that will basically be used to concatenate a bunch of
have one time consuming step that flattens a bunch of files. basically i'd like
Basically I have a getjson call to call for a bunch load of data.
I have a bunch of methods that make use of jquery to basically generate
Basically I have a bunch of repeated data in a bunch of text files
Basically I have a while loop that lists a bunch of names from my
I have a bunch of data in a table that serves as the parent
I'm getting confused by pointers in objective-c. Basically I have a bunch of static
I basically have 7 select statements that I need to have the results output

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.