Problem with Asp.net MVC routes

Asked

Viewed 87 times

-3

I have an application in which I put as a new site and it worked well, but when putting this application inside another, gives an error in the route. I need that when logging in, direct to "http://localhost:port/Documents/Panel" and he’s directing to "http://localhost:port/Paneeladm". Excerpt where it returns to the view "Paineladm":

[HttpPost]
        public ActionResult LogOn(FormCollection f, string returnUrl)
        {
            Conta user = new Conta();
            ContaModels atrrConta = new ContaModels();
            atrrConta = user.RetornaUser(f["login"]); 
            if (user.AutenticaUser(atrrConta, f["senha"]))
            {
                //Rotina para autenticar usuario
                if (returnUrl == "" || returnUrl == null)
                {
                    returnUrl = "/CalendarioAlertaSMS";
                }

                System.Web.Security.FormsAuthentication.SetAuthCookie(atrrConta.Ide_Perfil.ToString(), false); 

                Session["PERFIL"] = atrrConta.Ide_Perfil;
                Session["NOME"] = atrrConta.Nome;

                if (Session["PERFIL"].ToString() == "ADMIN")
                {
                     returnUrl = "/PainelAdm"; 
                }

                return Redirect(returnUrl);
            }
            else
            {
                ViewBag.Message = "Login ou senha inválidos.";
                return View();
            }
        }
  • 1

    Define "put application inside another". What would that be?

  • Have you made any modifications to Routeconfig.Cs ? Or are you using the default?

  • If possible, edit the issue by adding your Routeconfig.Cs code, I imagine you’re doing something wrong with it.

  • @Ciganomorrisonmendez, Dude that my problem I managed to solve, now the problem is, like, I have a site in classic Asp that through a button will call another application in mvc Asp.net. And I put this application in mvc inside the site that is in classic Asp. I need it to open through this site in classic Asp.

  • @Intruder, no, I haven’t made any changes, there’s only one snippet where I’m checking the user profile, which if he has the administrator profile he returns a different home than users who don’t have that profile, and it’s at this point that I’m going through the one that I mentioned in the question.

  • @Andreeh This is very crude. I would put each site in a different subdomain. MVC routes are not directories, and naturally IIS is lost when solving names.

  • @Romaniomorrisonmendez Beauty, I have done it, but how can I get the button of the site Classic Asp call this application mvc ?

  • @Andreeh Make a request hard, no relative paths. It does not cease to be another site elsewhere.

  • @Ciganomorrisonmendez, can you give me an example of how I do this ?

  • Ué, a link to http://meusite:port/

  • @Ciganomorrisonmendez Puts, I’ve tried this and it wasn’t. : S

  • @Ciganomorrisonmendez doesn’t work either, man, I just need you to redirect it like "http://lmeu_site:door/Documents/Paineladm". How can I set a course for this to work on iis ?

  • Different subdomains mean different virtual directories. You don’t understand this part?

  • @Gypsy.

Show 9 more comments

1 answer

0

A MVC application when placed inside another application does not even work, so it works to convert the internal application folder into an application.

inserir a descrição da imagem aqui

  • Dude, I did it, I have an independent application that works perfectly, but by putting it to be called inside a site on Asp classico is not working. The problem is with the route.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.