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 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

Ask A Question

Stats

  • Questions 235k
  • Answers 235k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you just want to extract the frames from a… May 13, 2026 at 6:11 am
  • Editorial Team
    Editorial Team added an answer You can’t. Zend_Form will translate your configuration keys to calls… May 13, 2026 at 6:11 am
  • Editorial Team
    Editorial Team added an answer Yup. Get it at sourceforge.net/projects/nhcontrib/files/NHibernate.Mapping.Attributes/ May 13, 2026 at 6:11 am

Related Questions

Basically I have a bunch of unmanaged VC++ static libraries. And the VC++ GUI
So basically, I have a bunch of TextBoxes that the user gets to fill
Basically, I have a list of colors and a defined datatemplate for listbox item:
Currently, I have a large SVN repository with a bunch of different projects within

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.