Ejemplo n.º 1
0
 public static void RedirectToErrorPage(ErrorTypes errorType, System.Web.HttpResponse response)
 {
     if (errorType == ErrorTypes.Generic)
     {
         response.Redirect("~/Error");
     }
     else if (errorType == ErrorTypes.Product)
     {
         response.Redirect("~/Error?type=product");
     }
     else if (errorType == ErrorTypes.Category)
     {
         response.Redirect("~/Error?type=category");
     }
 }
Ejemplo n.º 2
0
        public static void RedirectTo(
            System.Web.HttpResponse InResponse,
            string InPageDirPath, string InPageName, RedirectParms InParms)
        {
            bool bArgs = false;

            // Build the full path name needed to redirect to this page relative to the
            // current page ( the from page )
            System.Text.StringBuilder url = new System.Text.StringBuilder(256);
            if (InPageDirPath != null)
            {
                url.Append(InPageDirPath + "/");
            }
            url.Append(InPageName);

            // add the querystring parms.
            if (InParms.IsNotEmpty)
            {
                if (bArgs == false)
                {
                    url.Append("?" + InParms.QueryString);
                }
                else
                {
                    url.Append("&" + InParms.QueryString);
                }
                bArgs = true;
            }

            // redirect to the page.
            InResponse.Redirect(url.ToString());
        }
Ejemplo n.º 3
0
        public static void logout(HttpSessionState session, System.Web.HttpResponse response)
        {
            string url = FormsAuthentication.LoginUrl;

            session.Clear();
            session.Abandon();
            FormsAuthentication.SignOut();
            response.Redirect(url, true);
        }
Ejemplo n.º 4
0
        public static void RndUrl()
        {
            System.Web.HttpRequest  Request  = System.Web.HttpContext.Current.Request;
            System.Web.HttpResponse Response = System.Web.HttpContext.Current.Response;

            if (Request["Rnd"] == null || Request["Rnd"].Trim() == String.Empty)
            {
                String time0 = DateTime.Now.ToString();
                time0 = FormsAuthentication.HashPasswordForStoringInConfigFile(time0, "MD5");
                if (Request.RawUrl.IndexOf("?") < 0)
                {
                    Response.Redirect(Request.RawUrl + "?Rnd=" + time0, true);
                }
                else
                {
                    Response.Redirect(Request.RawUrl + "&Rnd=" + time0, true);
                }
            }
        }