1
I wanted something like this (it doesn’t work). "The Masterpagefile property can only be set in or before the 'Page_preinit' event'."
foreach (DataRow item in dt.Rows)
{
if (item["tipoLogin"].ToString().Contains("admin"))
{
MasterPageFile = "~/MasterPage.master";
Response.Redirect("HomeAdmin.aspx");
}
else
{
if (item["tipoLogin"].ToString().Contains("gestor"))
{
MasterPageFile = "~/MasterGestor.master";
Response.Redirect("HomeGestor.aspx");
}
else
{
if (item["tipoLogin"].ToString().Contains("responsavel"))
{
MasterPageFile = "~/MasterPageResponsavel.master";
Response.Redirect("HomeResponsavel.aspx");
}
}
}
}
Thank you
worked, I was long back from this , my brain gave tilt nor I paid attention to the error Thank you !
– Pedro Cardoso
@Pedrocardoso I’m glad to have helped, don’t forget to mark as accepted ;) so if others have the same question they will see how you solved the problem.
– Barbetta