Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > My Account redirect to login page View modes: 
User avatar
Member
Member
d.severi-netribegroup - 11/12/2013 5:54:21 AM
   
My Account redirect to login page
If the user is not authenticated your "My Account" remains blank. you can redirect to the login page in this case?

thanks

User avatar
Kentico Support
Kentico Support
kentico_romank - 11/12/2013 6:28:32 AM
   
RE:My Account redirect to login page
Hi,

You can achieve this behavior by modifying the MyAccount web part, please open Visual Studio and find the following file ~/CMSWebparts/Membership/Profile/MyAccount.ascx.cs, in this file around the line 1106 there is else branch which has only one line of code where is visibility set to false, to redirect the user you should modify code likes this:
else
{
// Hide control if current user is not authenticated
Visible = false;
Response.Redirect("http://somepage.com");
}
I hope this information helps.

Best Regards,
Roman Konicek

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 11/12/2013 10:50:09 AM
   
RE:My Account redirect to login page
You could also set the permissions on that page to require authentication. Then in the site settings you can set the check permissions and set a not authorized URL. Off the top of my head I don't remember the exact settings but that should get you in the right direction without modifying any code.