I have asp.net web site whit this folder structure ,
-MainFolder
-Account
-Login.aspx
-Register.aspx
-Script
-Styles
-userControls
-About.aspx
-Home.aspx
-Site.master
-Web.config
My problem is , when I go to Login.aspx
page and log in , It's redirect to default.aspx
.
(What I want is , if I log in from About.aspx
, after login successful , I want to redirect to About.aspx
)
And when I log out , it's redirect to http://localhost:-----/MainFolder/
(Directory Listing -- /MainFolder/) .
( What I want is , If I log out from About.aspx
, after log out successful , I want to redirect to About.aspx
) . How can I fix it ?
It looks like you are using some of the default set up for an ASP.NET web application project. Try setting the "DestinationPageURL" property of the asp:Login
control that's on the Login.aspx page:
Markup (notice I added the onloggedin="LoginUser_LoggedIn"
to the end):
<asp:Login ID="LoginUser" runat="server" EnableViewState="false"
RenderOuterTable="false" DestinationPageUrl="~/About.aspx"
OnLoggedIn="LoginUser_LoggedIn" >
You could also handled the "LoggedIn" event for that same Login control:
protected void LoginUser_LoggedIn(object sender, EventArgs e)
{
Response.Redirect("../About.aspx");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.