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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:15:49+00:00 2026-05-11T16:15:49+00:00

I have a URL: Shipment/Search/{searchType}/{searchValue} and a controller action: // ShipmentSearchType is an enum

  • 0

I have a URL:

Shipment/Search/{searchType}/{searchValue}

and a controller action:

// ShipmentSearchType is an enum ... PartNumber, CustomerOrder, etc...
ActionResult Search(ShipmentSearchType searchType, string searchValue)

So this means I can type in pretty urls like:

Shipment/Search/PartNumber/Widget-01

And get a list of all the shipments with that part number.

Now I’m doing the busy work of the application and got to the point where I am making a search form that asks for Part Number and it will post back to Search. So basically I want:

Shipment/Search/PartNumber/{user-input-from-textbox}

Unfortunately I can’t have a form get to the above url — it has to be generated server side. So instead I’ll have the form post back to Shipment/Search/PartNumber with {user-input} as a post request value.

So I end up with:

[AcceptVerbs(HttpVerbs.Post)]
ActionResult Search(ShipmentSearchType searchType, string searchValue, bool? post)
{
    return RedirectToAction("Search", new { searchType = searchType, searchValue = searchValue});
}

2 things:

1) Is there a way I can get around having the post method of Search without using javascript on the client side?

2) The bool? post value is there just so they have different signatures. That is obviously ugly. Is there a smarter way to do this?

Thanks!

edit:

“Unfortunately I don’t think I can do that from a form (without javascript at least).” & “Is there a way I can get around having the post without using javascript?”

This was a bit ambiguous. What I mean is that I don’t think I can have a form generate the url /Shipment/Search/PartNumber/{value-from-textbox} and have it to a form method get. I think this would be simple to do in javascript (override the submit action to build the url dynamically) but I haven’t done that. I didn’t mean that javascript is necessary to do a post.

  • 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-11T16:15:49+00:00Added an answer on May 11, 2026 at 4:15 pm

    i have same situation, but it work fine without javascript, i just receive FormCollections in [post]Search and then redirect to action like this:

    [AcceptVerbs(HttpVerbs.Post)]
    ActionResult Search(FormCollection form)
    {    return RedirectToAction("Search", new { searchType = form["searchType"], searchValue = form["searchValue"]}); }
    

    I think it is a good solution because i watched video about Post-Redirect-Get pattern which – good practicies in asp.net mvc applications.

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

Sidebar

Related Questions

I have a site that have URL similar to this: /mysite/admin/controller/action/id /mysite/search/controller/action/id /mysite/user/controller/action/id I
I know the rule of mydomain.com/controller/action URL, but is it possible to have URL
I have a url string like this: http://www.google.com/cse?cx=017840637368510444960:ny1lmky7r-0&client=google-csbe&output=xml_no_dtd&q=simon+g I need to send this url
I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&web=%2F&page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace
We have url: http://site.com/index.php?action=show $_GET['action'] is used in templates to check value of ?action=
In ASP.NET MVC, we have @Url.Action for actions. Is there something similar like @Url.Api
I have url like: http://www.matweb.com/search/DataSheet.aspx?MatGUID=849e2916ab1541be9ff6a17b78f95c82 I want to download source code from that page
I have URL like: http://example.com#something , how do I remove #something , without causing
I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST_TITLE%/ Now i want to
Is it possible in CakePHP to have URL aliases in routes.php? Or by what

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.