Working with a VS 2015 solution that has 2 sites, "projectA.site.com.br" and "projectB.site.com.br", their views and controllers are in the same project, named as "WEB", developed in C # .NET 4 with MVC 4, but in two folders, "Project A" and "Project B", that is, everything is organized.
The situation is as follows, when the user accesses the site "project.site.com" and clicks on an option, I will direct it to the registration site, which is in Project B, but a dropdown will be populated with certain values, and if the user reloads the page, this dropdown should be populated with different values.
Technically this is so, when the user clicks on the given option mentioned above, a method will be triggered in my controller of Project A, which in MVC TempData I enter the value 1, then I call the controller's Index () method of Project B
DESIGN A
VIEW
<li>
<a href="@Url.Action(MVC.ProjetoA.Home.AbrirCadastro())"><i class="fa fa-file-text-o"></i> Cadastro </a>
</li>
CONTROLLER
[RequiresAuthorization]
public virtual ActionResult AbrirCadastro()
{
Client dadosUsuario = ViewBag.User;
TempData["Teste"] = 1;
return Redirect(Url.SubdomainUrl(SubdomainConstants.Register, MVC.ProjetoB.Home.Index()));
}
In the Project B controller's Index () method I will have a validation to customize the values to be populated in the dropdown.
PROJECT B
CONTROLLER
[HttpGet]
public virtual ActionResult Index()
{
if (TempData["Teste"] != null)
{
//Preencho dropdown de uma maneira
}
else
{
//Preencho dropdown de outra maneira
}
return View();
}
But in my Index () method the TempData comes null. How do I send an information from the OpenCadastro () method, in the controller of Project A, to the method Index (), in the controller of Project B?
I need it to be temporary, that only the OpenCadastro () method sends, and that is not displayed in the URL, so that it is not traceable. I thought of working with Session (so the TempData) or with parameters in methods, however I do not know how to hide the parameter in the URL.