예제 #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");
     }
 }
예제 #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());
        }
예제 #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);
        }
예제 #4
0
파일: Comm.cs 프로젝트: sinyuewh/CJZC2007
        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);
                }
            }
        }