Ejemplo n.º 1
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (Request.Params.Count == 0)
        {
            Response.Redirect("~/Default.aspx");
        }

        string guid = null;

        if (Request.Params["oldGUID"] != null && Request.Params["newGUID"] != null)
        {
            string oldGUID = Request.Params["oldGUID"].ToString();
            guid = Request.Params["newGUID"].ToString();
            MySession.DuplicateSession(oldGUID, guid);
            SESSIONID.Value = guid;
            string parametres = MySession.GetParams();

            Uri    myUri       = new Uri(HttpContext.Current.Request.Url.AbsoluteUri);
            string redirection = "";
            if (parametres != null && parametres.Length > 0)
            {
                redirection = myUri.GetLeftPart(UriPartial.Path) + MySession.GenerateGetParamsWithNewGUID(parametres, guid);
            }
            else
            {
                redirection = myUri.GetLeftPart(UriPartial.Path) + MySession.GenerateGetParamsWithNewGUID(guid);
            }

            Response.Redirect(redirection);
        }
        else
        {
            if (guid == null || guid == string.Empty)
            {
                guid = Request.Form["ctl00$SESSIONID"];
            }
            if (guid == null || guid == string.Empty)
            {
                guid = MySession.GetParam("SESSIONID");
            }
            if (guid != null)
            {
                SESSIONID.Value = guid;
            }
        }
    }