views:

15

answers:

1

Hi All,

I have a small form with a single textbox and a submit button.

using (Html.BeginForm("Index", "Tag", FormMethod.Post)

In my tag controller i have a method that looks like:

public ActionResult Index(string tagText)

I'm trying to figure out first how to route this so the resulting URL will look like:

http://mydomain.com/Tag/tagText

And i guess i would also like to have this controller handle those types of URLs and return my view the same as if it was posted from the form i've shown above. I am a newb so thanks for any help!

A: 

From what I can see of your post you want the user to end up at a URL where the last bit is what they actually put in a text box. To do this you need your ActionResult to send

return RedirectToAction("Tag", new {tagText=tagText} )

then have a route which maps "/Tag/{tagText}".

Chao