Как я могу передать свой жестко закодированный идентификатор без перенаправления на страницу входа в систему
Currently when page run it go to the common login gateway/page but while running on local host, I want it to pass my user id directly which is registered in DB. protected void Page_Load(object sender, EventArgs e) { DBClass.Manager.DbType = "oracle"; objDatabase = DBClass.Manager.CreateDatabase(ConfigurationManager.AppSettings["ConnectionString"]); bool flag = true; try { //Response.Write(Request.ServerVariables["HTTP_REFERER"].ToString()); if (Request.ServerVariables["HTTP_REFERER"].ToString().Trim() != "http://realnet.in.ril.com/Realnet/aspx/mypage.aspx") { flag = false; } else { flag = true; } Response.Write(flag); } catch (Exception ex) { Response.Write(ex.Message); flag = false; } if (flag == true) { string uid = Request.QueryString["uid"].ToString(); //string uid = "37101621"; uid = uid.Substring(1, (uid.Length) - 1); string str = "select * from m_cmto_users a,m_cmto_roles b where a.user_role_code=b.role_code and user_ecno='" + uid + "' and user_flag='R'"; DataSet ds = objDatabase.ByText(str); if (ds.Tables[0].Rows.Count > 0) { //Response.Write(ds.Tables[0].Rows.Count); string username = ds.Tables[0].Rows[0]["user_name"].ToString(); string ecno = ds.Tables[0].Rows[0]["user_ecno"].ToString(); string role = ds.Tables[0].Rows[0]["role_desc"].ToString(); Session["username"] = username; Session["ecno"] = ecno; Session["role"] = role; Session["role_code"] = ds.Tables[0].Rows[0]["role_code"].ToString(); Session["SDate"] = System.DateTime.Now.ToString("dd MMM yyyy"); Response.Redirect("Cmto_Mainpage.aspx"); } else { Response.Redirect("http://realnet.in.ril.com/Realnet/aspx/mypage.aspx"); } } else { Response.Redirect("http://realnet.in.ril.com/Realnet/aspx/mypage.aspx"); } } }
Что я уже пробовал:
Я не могу найти никакой помощи, просто пытаясь прокомментировать страницу перенаправления.
Prifti Constantine
Вы можете сохранить переменную внутри сеанса, а затем получить ее с любой страницы, с которой захотите.