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
@Marconi, you can set up a Route in Webforms, follow a link from MSDN: ASP.NET Routing - Setting Default Values for URL Parameters
– Tobias Mesquita
@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
Marconi has this in my Web.config: <Forms name="login" loginUrl="~/Security/Login.aspx" defaultUrl="~/Admin/Default.aspx" timeout="120" />
– Mauricio Ferraz
@Mauricioferraz has already tried
<forms name="login" loginUrl="~/Seguranca/Login.aspx" defaultUrl="~/Seguranca/Login.aspx" timeout="120" />
?– Marconi
@Very likely you are already trying to access the default page through the `defaultUrl="~/Admin/Default.aspx"``.
– Marconi
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.
– Mauricio Ferraz
@Mauricioferraz Conseguiu?
– Marconi
@Marconi I’ve been away for a few days, I did get thanks.
– Mauricio Ferraz
@Mauricioferraz good that I could help.
– Marconi