Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC 3 Redirect to Action on Subdomain

I have a website I am developing (http://www.mywebsite.com/) that makes use of subdomains. Basically what I want is when you go to: http://www.mywebsite.com/Redirect, it redirects you to http://blahblah.mywebsite.com/SpecificController/SpecificAction.

I know about Redirect, but that doesn't let you send POST parameters (as far as I know), and RedirectToAction doesn't let you specify a subdomain.

like image 846
Entity Avatar asked Nov 13 '22 11:11

Entity


1 Answers

For subdomains in routes check this guide to domain routing

When you have it set up. for a specific redirection you can use this:

return RedirectToAction("SpecificAction", 
        "SpecificController",
         new { subdomain = "blahblah");

As for the post part, you can just use the TempData dictionary (TempData["varName"]) to pass the data to the next controller/action

like image 153
Mihalis Bagos Avatar answered Dec 09 '22 05:12

Mihalis Bagos