#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    120
    Rep Power
    14

    Master Page Load Event


    i m facing a little issue while using response.redirect in master page load event as it didn't redirect the page to login screen if session
    variable not found or null but page load event continuously triggers several time and didn't redirects


    Code:
    protected void Page_Load(object sender, EventArgs e)
            {
                try
                {
                    if (!Page.IsPostBack)
                    {
                        if (Session["HushHush"] != null)
                        {
                        }
                        else
                        {
                            Response.Redirect("~/Account/Login.aspx", false);
                            //Response.Redirect("~/Account/Login.aspx", true);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Stevens Point, Wisconsin
    Posts
    623
    Rep Power
    18
    In debugging your code, you're saying that it falls into the else block? Any difference with the endResponse param set to true?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    123
    Rep Power
    12
    use ResolveUrl when you using urk like "~/Account/Login.aspx" you need to add ResolveUrl otherwise system can not find you page.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    120
    Rep Power
    14

    Thumbs up


    Originally Posted by gk53
    use ResolveUrl when you using urk like "~/Account/Login.aspx" you need to add ResolveUrl otherwise system can not find you page.
    I have found the answer by using static class in app_code folder and then using response redirect with false in second parameter.

IMN logo majestic logo threadwatch logo seochat tools logo