1
Working with a Solution VS 2015 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 access the site "projectA.site.com.br" and click on a certain option, I will direct it to the registration site, which is in Project B, but a dropdown will be filled with certain values, and if the user reloads the page, this dropdown must be filled with other different values.
Technically, when the user clicks on a certain option, mentioned above, a method will be triggered in my Project A controller, which in MVC Tempdata I enter the value 1, then call the Index() method of the Project B controller
PROJECT 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 Index() method of the Project B controller I will have a validation to customize the values to be filled 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 Tempdata is null. How do I send information from the Open Register() method, in the Project A controller, to the Index() method, in the Project B controller?
I need it to be something temporary, that only the Open Registration() method send, and that is not displayed in the URL, so that it is not traceable. I thought about working with Session (that’s why Tempdata) or with parameters in methods, but I don’t know how to hide the parameter in the URL.
The question here is not whether you intend to make this "exchange" of information between two classes. You need to think of your project as an application, you need to explain to us which flow this way. The Project A and the Project B are what? Websites? Webservices?
– Jéf Bueno
They are two sites that access via URL, for example, the project to "projectoa.site.com.br" and project B "projetob.site.com.br". The user will log into the project website b, click on a menu option, then need to send a temporary data of the proejto class b to the project site index a. If the project receives a new request, the temporary data should not exist.
– Felipe Negro
You will have to do a POST sent this data or something... This comment already helps a lot in understanding the question, but it is still a little difficult to understand what and how you intend to do.
– Jéf Bueno
In what is written to access classes, summary "CAN’T".
– novic
@Felipenegro, it doesn’t matter if you’re in it Solution. If they are different applications, they are different applications and that’s it. You’re going to have to use the resources available to make this communication. Of course, depending on the case, there may be direct communication, but from what you explained, this is the right way. Feel free to [Dit] the question and help understanding. At first that’s right, will have to send the information via HTTP.
– Jéf Bueno
@jbueno I’ll try to make it clear. The user will enter the site "projectB.site.com.br" with his account, there will be in the menu an option that he clicking on this option should open the site "projectA.site.com.br" with a dropdown filled with information 1, 2 and 3, if he gives a F5 in the browser, will open the same site, but the dropdown filled with 5, 6 and 7, basically.
– Felipe Negro
Improved a little more, but it’s still a little confused. I keep what I said, will have to send the information via HTTP.
– Jéf Bueno
@jbueno Rsrs. Is there any article I can study how to do what you propose, please?
– Felipe Negro
@Felipenegro I don’t know if I understand this correctly, but have you ever thought about passing this value by queryString, for example: projectA.site.com.br/Home/Index/value-here and after loading the page just remove queryString. So when updating the value will be different.
– Randrade
Without understanding what you need, it is difficult to give suggestions, as they may not suit your context
– Randrade
@And how could I do that?
– Felipe Negro
I edited the question to make it clearer
– Felipe Negro
Both of you are in the same dolmen?
– Randrade
Let’s go continue this discussion in chat.
– Felipe Negro