Routes or Urls in ASP.NET Web Forms

Asked

Viewed 198 times

1

I have an ASP.NET application with Webforms it is hosted as follows: http://meusite.com.br/MeuAplicativo/Seguranca/Login.aspx.

I want that when you type in the browser http://meusite.com.br/MeuAplicativo he goes straight to http://meusite.com.br/MeuAplicativo/Seguranca/Login.aspx.

I know you can do this in ASP.NET MVC through the routes but how can I do in Webforms?

Another detail is that I use Formsauthentication and sometimes when I type: http://meusite.com.br/MeuAplicativo

He forwards to: http://meusite.com.br/MeuAplicativo/Seguranca/Login.aspx?ReturnUrl=%2fMeuAplicativo

After I log in it redirects to http://meusite.com.br/MeuAplicativo and appears page error not found.

  • You have this on your webConfig? <forms loginUrl="Login.aspx" defaultUrl="Login.aspx" />

  • @Marconi, you can set up a Route in Webforms, follow a link from MSDN: ASP.NET Routing - Setting Default Values for URL Parameters

  • @Tobymosque plus that I posted in the comment should already solve his problem. I also used the Set Start Page right-clicking on the page.

  • Marconi has this in my Web.config: <Forms name="login" loginUrl="~/Security/Login.aspx" defaultUrl="~/Admin/Default.aspx" timeout="120" />

  • @Mauricioferraz has already tried <forms name="login" loginUrl="~/Seguranca/Login.aspx" defaultUrl="~/Seguranca/Login.aspx" timeout="120" /> ?

  • @Very likely you are already trying to access the default page through the `defaultUrl="~/Admin/Default.aspx"``.

  • I added this to my web config <system.webserver> <defaultDocument> <files> <clear /> <add value="Security/Login.aspx" /> </files> </defaultDocument> </system.webserver> I removed this: <Authorization> <Deny users="*" /> </Authorization> Apparently it worked running localhost, I will go up to the hosting to test.

  • @Mauricioferraz Conseguiu?

  • @Marconi I’ve been away for a few days, I did get thanks.

  • @Mauricioferraz good that I could help.

Show 5 more comments
No answers

Browser other questions tagged

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