PDA

View Full Version : سوال: مشکل در ریدایرکت کردن در مبحث رولینگ



Me3ter
پنج شنبه 23 آذر 1391, 17:18 عصر
سلام
برای رولینگ کردن سه تا جدول درست کردم یکی جدول رول (rolid,roltitle) و رول پیج (pagetitle,rolid)و ممبر
(username,pasword,rol)
یک صفحه لوگین که داخلش این کد رو گزاشتم
if(login.chekathuntication(TextBox1.Text))//vase chek kardane tedad user
{
int a = new bll.customer().custom_login(TextBox1.Text, TextBox2.Text); //chek kardane //userpass
if (a == 1)
{
string rol = login.chekroluser(TextBox1.Text);//gereftane role user
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, TextBox1.Text, DateTime.Now, DateTime.Now.AddHours(1), false, rol);
string Encryptticket = FormsAuthentication.Encrypt(ticket);

HttpCookie athunCookie = new HttpCookie(FormsAuthentication.FormsCookieName, Encryptticket);//cookie sakhtim vase ferestadane ticket ke havi etelaaat karbarie

if (chekrem.Checked == true)
athunCookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(athunCookie);
Response.Redirect(FormsAuthentication.GetRedirectU rl(TextBox1.Text,chekrem.Checked));


}
else
Response.Write("invalid");

}
اینم کدیه که داخل مستر پیج گزاشتم

if (!IsPostBack)
{
if (HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName.ToString()] != null)
{
bll.customer getrol = new bll.customer();
string mypage = System.IO.Path.GetFileName(Request.Path);
string rolpage = getrol.getrolpage(mypage);//esme page ro migire rolesho bar //migardone az jadvale ropage
if (Page.User.Identity.IsAuthenticated)
{

switch (Page.User.IsInRole(rolpage))
{
case false:
Response.Redirect("msg_page.aspx");
break;
}
}
else
{

FormsAuthentication.RedirectToLoginPage();

}

}

}
همش درست کارمیکنه فقط وقتی که با یک یوزر که رول1 رو داره روی لینک یک صفحه کلیک میکنم که رولش 2 هست باید به این پیج بره ولی اررور میده در واقه ریدایرکت نمیکنه
error:
This webpage has a redirect loop
The webpage at http://localhost:6134/msg_page.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
لطفا راهنمایی کنید کلافه شدم

Me3ter
پنج شنبه 23 آذر 1391, 22:46 عصر
کسی نیست ؟