web page has too many redirects [Resolved]

Posted by Oswaldlily under ASP.NET on 3/5/2013 | Points: 10 | Views : 14471 | Status : [Member] | Replies : 4
In Page load of master I have included this
page_Load(..)
{

Session["Userid"] = "";
if (Session["Userid"].ToString() != "")
{
///do code
}
else
{
Response.Redirect("../Administration/Login.aspx");
}
}
error:

The webpage at http://localhost:50250/Administration/Login.aspx has resulted
in too many redirects




Responses

Posted by: Vuyiswamb on: 3/6/2013 [Member] [MVP] [Administrator] NotApplicable | Points: 50

Up
0
Down

Resolved
It is because you are not suppose to place that code in the master page, take that code and place it in the content page. Your master page is redirecting at the same time i pressume you have the same code in the content page which also redirects, so you have two redicts happening at the same time

Thank you for posting at Dotnetfunda
[Administrator]

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 3/5/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Oswaldlily

Try including the Code in if(!isPostback) in page load
This way

page_Load(..)
{
if(!isPostBack)
{
Session["Userid"] = "";
if (Session["Userid"].ToString() != "")
{
///do code
}
else
{
Response.Redirect("../Administration/Login.aspx");
}
}
}



Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/5/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try this code working

Response.Redirect("Admin/Login.aspx");

Mark as Answer if its helpful to you

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 3/6/2013 [Member] Starter | Points: 25

Up
0
Down
@Raj.Trivedi

Still the same..not working

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response