public static void RedirectToReturnUrl(string returnUrl, HttpResponse response) { if (!String.IsNullOrEmpty(returnUrl) && IsLocalUrl(returnUrl)) { response.Redirect(returnUrl); } else { response.Redirect("~/"); } }
public static void Find(HttpResponse Response, TextBox txtCode) { if (txtCode == null) return; string key = txtCode.Text.Trim(); if (key.Length == 0) return; string pattern = @"\d+"; Regex regx = new Regex(pattern); if (BarcodeBLL.IsValidPeopleCode(key)) { People r = PeopleBLL.GetByCode(key); if (r != null) { Response.Redirect(RedBloodSystem.Url4PeopleDetail + "key=" + r.ID.ToString()); } } else if (BarcodeBLL.IsValidDINCode(key)) { Response.Redirect(RedBloodSystem.Url4DINDetail + "key=" + BarcodeBLL.ParseDIN(key)); } //else if (BarcodeBLL.IsValidDINCode_NoIdChar(key)) //{ // Response.Redirect(RedBloodSystem.Url4DINDetail + "key=" + BarcodeBLL.ParseDIN_NoIdChar(key)); //} else if (BarcodeBLL.IsValidCampaignCode(key)) { Campaign r = CampaignBLL.Get(BarcodeBLL.ParseCampaignID(key)); if (r != null) { Response.Redirect(RedBloodSystem.Url4CampaignDetail + "key=" + r.ID.ToString()); } } else if (BarcodeBLL.IsValidOrderCode(key)) { Order r = OrderBLL.Get(BarcodeBLL.ParseOrderID(key)); if (r != null) { Response.Redirect(RedBloodSystem.Url4Order4CR + "key=" + r.ID.ToString()); } } else if (key.Length > 3 && key.Substring(0, 3) == "/n:") { Response.Redirect(RedBloodSystem.Url4FindPeople + "key=" + key.Substring(3).Trim()); } else if (regx.IsMatch(key) && key.Length >= BarcodeBLL.CMNDLength.ToInt()) { People r = PeopleBLL.GetByCMND(key); if (r != null) { Response.Redirect(RedBloodSystem.Url4PeopleDetail + "key=" + r.ID.ToString()); } } txtCode.Text = ""; }
public static void checkloggedin(HttpResponse myresponse, HttpSessionState mysession, string to_page) { var to_url = "login.aspx"; if (to_page != "") to_url += "?page=" + to_page; if (mysession["fullname"] == null) { myresponse.Redirect(to_url, true); } else { if (mysession["fullname"].ToString().Trim() == "") { myresponse.Redirect(to_url, true); } } }
// エラーページへ転送します。可能ならばAzureのテーブルにロギングします // なお、転送先のエラーページはweb.configのcustomErrorsセクションで定義しません private void RedirectToNotFoundPage(Exception exception, HttpResponse response, Boolean isLogging) { if (exception == null) { return; } string path = ErrorPagePath; if (!this.Request.Path.Contains("ja-JP")) { path = path.Replace("ja-JP", "en-US"); response.Redirect(path, false); } if (exception.GetType() == typeof(HttpRequestValidationException)) { if (isLogging) { AzureLog.WriteToTable(exception); } response.Redirect(path, false); } else { if (isLogging) { AzureLog.WriteToTable(exception); } response.Redirect(path, false); } }
public static void RedirectUrl(HttpResponse response) { var url = PortalContext.RootContext.URL; JCUtilities.ResolveUrl(url); response.Redirect(url, false); }
public void start(Analysis parent, HttpResponse response, System.Web.SessionState.HttpSessionState session) { caller = parent; Debug.WriteLine("SelectData step of " + caller.getDisplayName() + " started"); session["stepid"] = 1; response.Redirect("~/Default.aspx"); }
public void ProcessRequest(HttpContext context) { Int32 userid = SessionData.UserID; String uploadFileDir = ConfigurationManager.AppSettings["UploadFolderPath"]; System.Web.HttpRequest request = System.Web.HttpContext.Current.Request; string startDate = request.QueryString["startDate"]; string endDate = request.QueryString["endDate"]; string uploadfilepath = MppUtility.GetFilelocation(userid, uploadFileDir, "bulk"); string fileName = ConfigurationManager.AppSettings["filename"]; string fileName1 = fileName.PadRight(29) + MppUtility.DateFormat(Convert.ToDateTime(startDate), 2) + "-" + MppUtility.DateFormat(Convert.ToDateTime(endDate), 2) + ".csv"; string filePath = Path.Combine(uploadfilepath, fileName1); bool test = System.IO.File.Exists(filePath); System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; if (System.IO.File.Exists(filePath)) { response.ClearContent(); response.Clear(); byte[] Content = System.IO.File.ReadAllBytes(filePath); response.ContentType = "text/csv"; response.AddHeader("content-disposition", "attachment; filename=" + fileName1 + ".csv"); response.BufferOutput = true; response.Cache.SetCacheability(HttpCacheability.NoCache); response.OutputStream.Write(Content, 0, Content.Length); response.Flush(); response.End(); } else { response.Redirect("ShowStatus.html"); } }
/// <summary> /// 写入到http回应 /// </summary> /// <param name="response"></param> public void WriteResponse(HttpResponse response) { if (Permanent) { response.RedirectPermanent(Url); } else { response.Redirect(Url); } }
public void SignInRedirect() { // Create an instance of Yahoo.Authentication Yahoo.Authentication auth = new Authentication("myappid", "mysharedsecret"); // Redirect the user to the use sign-in page Response.Redirect(auth.GetUserLogOnAddress().ToString()); }
public static void CheckSession(System.Web.SessionState.HttpSessionState session, HttpRequest request, HttpResponse response) { if (session["person.id"] == null) { string url = request.Url.PathAndQuery; //session["lasturl"] = "~" + url; session["lasturl"] = url; response.Redirect("~/person/account/login.aspx"); } int passworduserchanged = Functions.ParseInt(session["person.passworduserchanged"],0); if (0 == passworduserchanged) { string url = request.Url.PathAndQuery; if (!url.Contains("/person/account/changepassword.aspx")) response.Redirect("~/person/account/changepassword.aspx?needuserchange=1"); } }
public static void handleRequest(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response) { // Toggle cookie-control HttpCookie cookie = request.Cookies["cookie-control"]; if (cookie != null) { cookie.Expires = DateTime.Now.AddDays(-1); response.Cookies.Add(cookie); } else response.Cookies.Add(new HttpCookie("cookie-control", "1")); // Redirect to the origin or homepage if (request.UrlReferrer != null) response.Redirect(request.UrlReferrer.AbsoluteUri); else response.Redirect(pageElements["URL"]); }
public void ProcessRequest(HttpContext context) { System.Web.HttpRequest Request = context.Request; System.Web.HttpServerUtility Server = context.Server; System.Web.HttpResponse Response = context.Response; _file = Request.QueryString["file"]; try { Type = (DownloadType)Enum.Parse(typeof(DownloadType), Request.QueryString["Type"]); } catch (Exception Ex) { Response.Redirect("~/"); } string path = ""; switch (_Type) { case DownloadType.News: path = Folders.NewsFile + "/"; _file = string.Format("{0}/{1}{2}", WebContext.StartDir, path, _file); break; case DownloadType.Downloads: //_file = Server.MapPath(_file); break; default: _file = string.Format("{0}/{1}{2}", WebContext.StartDir, path, _file); break; } FileInfo fi = new FileInfo(Server.MapPath(_file)); string mimeType = IO.GetMimeType(_file); if (mimeType == "") { mimeType = "application/force-download"; } //Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name); Response.AddHeader("Content-Type", mimeType); Response.AddHeader("Content-Length", fi.Length.ToString()); Response.WriteFile(fi.FullName); Response.Flush(); Response.End(); }
/// <summary> /// Reloads the redirect. /// </summary> /// <param name="reportId">The report id.</param> /// <param name="response">The response.</param> public static void ReloadRedirect(int reportId, HttpResponse response) { var url = string.Format( "{0}?ReportId={1}&IsCopy=True", HttpContext.Current.Request.Url.AbsolutePath, reportId); response.Redirect(url); }
public void LoginUser(HttpRequest request, HttpResponse response, string username, string password) { var result = _UserRepository.LogInUser(username, password); if (result > 0) { AddCookie(request, response, result.ToString()); response.Redirect("HomeWebForm.aspx"); } }
private static void Redirect(HttpResponse response, string url, bool permanent) { if (permanent) { response.RedirectPermanent(url, true); } else { response.Redirect(url, false); } }
public Language ProccessLanguageForRequest(User user, HttpRequest request, HttpResponse response) { Language language; string pathCountryCode; UrlCountryCodeHelper.GetPathCountryCodeParts(request.Url.GetComponents(UriComponents.Path, UriFormat.Unescaped), out pathCountryCode); if (LanguageMappingHelper.CountryCodeIsSupported(pathCountryCode)) { language = LanguageMappingHelper.GetLanguageByCountryCode(pathCountryCode); var userLanguage = GetLanguage(user, request); if (!userLanguage.HasValue || userLanguage.Value != language) ChangeLanguage(user, language, response); } else { if (user != null) { var userLanguage = GetAuthenticatedUserLanguage(user); if (userLanguage.HasValue) language = userLanguage.Value; else { language = _ipToLanguageConverter.GetLanguage(request.UserHostAddress); ChangeAuthenticatedUserLanguage(user, language); } } else { var cookieLanguage = GetNonAuthenticatedUserLanguage(request); if (cookieLanguage.HasValue) language = cookieLanguage.Value; else { language = _ipToLanguageConverter.GetLanguage(request.UserHostAddress); ChangeNonAuthenticatedUserLanguage(language, response); } } } var correctPathCountryCode = LanguageMappingHelper.GetCountryCodeByLanguage(language); if (pathCountryCode != correctPathCountryCode) { var newUrl = UrlCountryCodeHelper.ChangeUrlCountryCodePart(request.Url, language); response.Redirect(newUrl); } HttpContext.Current.Items[FrontendConstants.LanguageKey] = language; var cultureInfo = LanguageMappingHelper.GetDefaultCultureInfo(language); Thread.CurrentThread.CurrentUICulture = cultureInfo; Thread.CurrentThread.CurrentCulture = cultureInfo; return language; }
static void EnsureHttps(HttpRequest req, HttpResponse res) { if (req.IsSecureConnection) return; if (req.IsLocal && DebugMode) return; res.Redirect($"https://{req.Url.Authority}{req.Url.PathAndQuery}"); }
public static void CheckSession(System.Web.SessionState.HttpSessionState session, HttpRequest request, HttpResponse response) { if (session["corpadmin.id"] == null) { string url = request.Url.PathAndQuery; //session["lasturl"] = "~" + url; session["lasturl"] = url; response.Redirect("~/corp/account/login.aspx"); } }
public static void LoggedOnOrRedirectToLogin( System.Web.SessionState.HttpSessionState Session, System.Web.HttpResponse Response, System.Web.HttpRequest Request) { if (!IsLoggedOn(Session, false)) { string b64Info = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(Request.RawUrl)); Response.Redirect("~/Login?" + ConstantStrings.url_Redirect + "=" + b64Info); } }
public static void LoggedOnOrRedirectToRoot( System.Web.SessionState.HttpSessionState Session, System.Web.HttpResponse Response, bool checkForAdmin ) { if (!IsLoggedOn(Session, checkForAdmin)) { Response.Redirect("~/default.aspx"); } }
public static bool IsValidateRequest(System.Web.HttpResponse Response, System.Web.SessionState.HttpSessionState Session, string tag) { if (SessionVariables.LoggedIn == false) { Response.Redirect("Login.aspx", true); return(false); } try { string sql = "SELECT role, tag FROM roleaccess WHERE role = @roleid and tag = @tag;"; SQLiteCommand cmd = new SQLiteCommand(); cmd.Connection = new SQLiteConnection(Code.DAL.ConnectionString); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = sql; cmd.Parameters.Add("@roleid", DbType.String).Value = SessionVariables.LoggedRoleId; cmd.Parameters.Add("@tag", DbType.String).Value = tag; DataTable dt = Code.DAL.ExecuteCmdTable(cmd); if (dt.Rows.Count == 0) { Response.Redirect("Login.aspx", true); return(false); } if (dt.Rows[0]["tag"].ToString() == tag) { return(true); } } catch (Exception ex) { Response.Redirect("Login.aspx", true); return(false); } Response.Redirect("Login.aspx", true); return(false); }
/// <summary> /// 安全的Response.Redirect() /// </summary> public static void SafeResponseRedirect(HttpResponse response, string title, string url, bool endResponse) { try { response.Buffer = true; response.Redirect(url); } catch (ThreadAbortException tae) { //Logger.LogInfo("PublicMethodBLL", "SafeResponseRedirect", 0, "\"" + title + "\"页面在使用Response.Redirect()转向到\"" + url + "\"页面时发生异常,只做为记录,不影响程序正常运行。", null); } }
/// <summary>NoRight /// </summary> /// <param name="request"></param> /// <param name="respond"></param> public static void ResponseNoRight(HttpRequest request, HttpResponse respond) { if (IsAjax(request)) { respond.Write(ResponseCodeEntity.NoRight); respond.End(); } else { respond.Redirect(ResponseCodeEntity.NoRightURL);//需要改成非调转形式 respond.End(); } }
/// <summary>URL404 /// </summary> /// <param name="request"></param> /// <param name="respond"></param> public static void ResponseNotfound(HttpRequest request, HttpResponse respond) { if (IsAjax(request)) { respond.Write(ResponseCodeEntity.CODE404); respond.End(); } else { respond.Redirect(ResponseCodeEntity.ULR404); respond.End(); } }
public void PostLoginProcess(IGNITE_MODEL.LoginViewData retObj, HttpResponse res) { if (retObj.Success) { EncryptDecryptUtil ecd = new EncryptDecryptUtil(); Session["userid"] = retObj.UserId; Session["username"] = ecd.DecryptData((retObj.UserName).ToString(), ecd.GetEncryptType()); Session["p_detail"] = retObj.Password; Session["LastLoggedIN"] = retObj.LastLoggedIN; Session["UserType"] = retObj.UserType; Session["PhysicianID"] = retObj.PhysicianID; Session["FirstName"] = ecd.DecryptData((retObj.FirstName).ToString(), ecd.GetEncryptType()); Session["LastName"] = ecd.DecryptData((retObj.LastName).ToString(), ecd.GetEncryptType()); Session["name"] = ecd.DecryptData((retObj.FirstName).ToString(), ecd.GetEncryptType()) + " " + ecd.DecryptData((retObj.LastName).ToString(), ecd.GetEncryptType()); Session["ReferenceID"] = retObj.ReferenceID.ToString(); if (retObj.UserType == "AuthorizedUser") { res.Redirect("AuthorizedUserForm.aspx"); } else { if (retObj.LastLoggedIN == null) { res.Redirect("TermsConditions.aspx"); } else { res.Redirect("Chat.aspx"); } } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "showmsg", "showMessage()", true); } }
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { HttpRequest request = context.Request; m_response = context.Response; m_nuxleusAsyncResult = new Nuxleus.Core.NuxleusAsyncResult(cb, extraData); m_returnFile = false; string fileName = request.PhysicalPath; m_fi = new FileInfo(fileName); if (!m_fi.Exists || !ValidFileName(fileName)) throw new HttpException(404, String.Format("Path {0} was not found.", request.FilePath)); if ((m_fi.Attributes & FileAttributes.Directory) != 0) { m_response.Redirect(request.Path + '/'); m_nuxleusAsyncResult.CompleteCall(); return m_nuxleusAsyncResult; } string strHeader = request.Headers["If-Modified-Since"]; try { if (strHeader != null) { DateTime dtIfModifiedSince = DateTime.ParseExact(strHeader, "r", null); DateTime ftime; ftime = m_fi.LastWriteTime.ToUniversalTime(); if (ftime <= dtIfModifiedSince) { m_response.StatusCode = 304; m_nuxleusAsyncResult.CompleteCall(); return m_nuxleusAsyncResult; } } } catch { } try { if (!m_mimeType.IsInitialized) m_mimeType.Init(); m_returnFile = true; m_nuxleusAsyncResult.CompleteCall(); return m_nuxleusAsyncResult; } catch (Exception e) { throw new HttpException(403, e.Message); } }
/// <summary> /// Method check user is force logout. When user is force logout redirect to login page /// </summary> /// <param name="context">SessionContext in webpage</param> /// <param name="response">Response in webpage</param> public static void RedirectUserMultipleLogin(BizPortalSessionContext context, System.Web.HttpResponse response) { if (RedirectUserMultipleLoginBooleanValue(context)) { try { response.Redirect("~/login.aspx"); } catch { DevExpress.Web.ASPxClasses.ASPxWebControl.RedirectOnCallback("~/login.aspx"); } } }
public void SignOut(HttpResponse response, HttpSessionState sessionState) { var user = GetUser(false); Logger.Log.Error(string.Format("User {0} sing out.", user.UserName)); response.Cache.SetCacheability(HttpCacheability.NoCache); response.Cache.SetExpires(DateTime.Now); FormsAuthentication.SignOut(); sessionState.Abandon(); response.Redirect(@"~/Index.aspx"); response.End(); }
public void CheckLogin(string PageName) { g.User = (string)Session["User"]; g.UserAccessLevel = (PageAccess.AccessLevels)(Session["AccessLevel"] != null ? Session["AccessLevel"] : PageAccess.AccessLevels.General); //g.User = CookieStr("User"); if (g.User == null || g.User == "") { //Response.Redirect("Default.aspx"); Response.Redirect("~/Default.aspx"); //Response.End(); //Response.Write("Redirect to " + VirtualPathUtility.ToAppRelative("~/Default.aspx")); } else { // refresh to keep session from timing out Session["User"] = g.User; } //if (Page != null && Page.AccessLevel > g.UserAccessLevel) //{ // Response.Redirect("~/Job.aspx"); //} }
public static void correspondingAction(calendar_notification not,HttpSessionState session, HttpResponse response) { calendar_entity db = new calendar_entity(); string redurl = not.redirecturl; Guid userid2 = (Guid)not.userid2.Value; string user2name= Membership.GetUser(not.userid2, true).UserName; DAL.Notification_DAL.deleteById(db, not.id); if (not.eventtype == "addfriend") { Utilities.Utilities.redirectToFriendHome(session, response,userid2,user2name); } else if (not.eventtype == "commentedOnWall") { response.Redirect("Default.aspx"); } else if (not.eventtype == "joinevent") { response.Redirect(redurl); } }
private void Page_Load(object sender, System.EventArgs e) { bool success = false; // Retrieve this user's authentication object we've stored in the session state Yahoo.Authentication auth = Session["Auth"] as Yahoo.Authentication; if (auth == null) { // We have a problem with the current session, abandon and retry Session.Abandon(); Response.Redirect("ErrorPage.aspx"); } // Check if we are returning from login if (Request.QueryString["token"] != null && Request.QueryString["token"].Length > 0) { // Make sure the call is valid if (auth.IsValidSignedUrl(Request.Url) == true) { success = true; // Save the user token. It is valid for two weeks auth.Token = Request.QueryString["token"]; } } // Redirect if we succeeded if (success == true) { Response.Redirect("Default.aspx"); } else { Response.Redirect("SignInError.aspx"); } }
/// <summary> /// 审核 /// </summary> public void AuditKeywordBidding(int Status) { string KeywordBidding_ID = tools.CheckStr(Request["KeywordBidding_ID"]); if (KeywordBidding_ID == "") { Public.Msg("error", "错误信息", "请选择要操作的信息", false, "{back}"); return; } if (tools.Left(KeywordBidding_ID, 1) == ",") { KeywordBidding_ID = KeywordBidding_ID.Remove(0, 1); } QueryInfo Query = new QueryInfo(); Query.PageSize = tools.CheckInt(Request["rows"]); Query.CurrentPage = tools.CheckInt(Request["page"]); string keyword = tools.CheckStr(Request["keyword"]); Query.ParamInfos.Add(new ParamInfo("AND", "str", "KeywordBiddingInfo.KeywordBidding_Site", "=", Public.GetCurrentSite())); Query.ParamInfos.Add(new ParamInfo("AND", "int", "KeywordBiddingInfo.KeywordBidding_ID", "in", KeywordBidding_ID)); IList <KeywordBiddingInfo> entitys = MyBLL.GetKeywordBiddings(Query, Public.GetUserPrivilege()); if (entitys != null) { foreach (KeywordBiddingInfo entity in entitys) { entity.KeywordBidding_Audit = Status; MyBLL.EditKeywordBidding(entity); } } Response.Redirect("/keywordbidding/keywordbidding_list.aspx"); }
public void Redirect() { var writer = new StringWriter(); // Type var @this = new HttpResponse(writer); // Examples try { @this.Redirect("http://zzzportal.{0}", "com"); } catch { } }
private static FileInfo GetFileInfo(string virtualPathWithPathInfo, string physicalPath, HttpResponse response) { FileInfo info; if (!FileUtil.FileExists(physicalPath)) { throw new HttpException(0x194, System.Web.SR.GetString("File_does_not_exist")); } if (physicalPath[physicalPath.Length - 1] == '.') { throw new HttpException(0x194, System.Web.SR.GetString("File_does_not_exist")); } try { info = new FileInfo(physicalPath); } catch (IOException exception) { if (!HttpRuntime.HasFilePermission(physicalPath)) { throw new HttpException(0x194, System.Web.SR.GetString("Error_trying_to_enumerate_files")); } throw new HttpException(0x194, System.Web.SR.GetString("Error_trying_to_enumerate_files"), exception); } catch (SecurityException exception2) { if (!HttpRuntime.HasFilePermission(physicalPath)) { throw new HttpException(0x191, System.Web.SR.GetString("File_enumerator_access_denied")); } throw new HttpException(0x191, System.Web.SR.GetString("File_enumerator_access_denied"), exception2); } if ((info.Attributes & FileAttributes.Hidden) != 0) { throw new HttpException(0x194, System.Web.SR.GetString("File_is_hidden")); } if ((info.Attributes & FileAttributes.Directory) != 0) { if (StringUtil.StringEndsWith(virtualPathWithPathInfo, '/')) { throw new HttpException(0x193, System.Web.SR.GetString("Missing_star_mapping")); } response.Redirect(virtualPathWithPathInfo + "/"); } return info; }
/// <summary> /// 转向登录页面 /// </summary> /// <param name="Request"></param> /// <param name="Response"></param> /// <param name="PortalRoot"></param> public static void RedirectLogin(System.Web.HttpRequest Request, System.Web.HttpResponse Response, string PortalRoot) { // 添加判断:管理后台,不跳转到根目录的登录界面 if (Request.Url.AbsoluteUri.ToLowerInvariant().IndexOf((PortalRoot + "/Admin").ToLowerInvariant()) > -1) { return; } if (Request.Url.ToString().ToLower().Contains("login.aspx")) { return; } // 获得登陆页面 string loginUrl; string loginParam = "q=" + System.Web.HttpUtility.UrlEncode(Request.Url.ToString()); loginUrl = System.IO.Path.Combine(OThinker.H3.Controllers.AppConfig.PortalRootForUrl, "Login.aspx").Replace('\\', '/') + "?" + loginParam; // 转向登录界面 Response.Redirect(loginUrl); }
/// <summary> /// ''' Cria um redirecionamento permanente na aplicação /// ''' </summary> /// ''' <remarks>Desenvolvido por Michel Oliveira @ Prime Team Tecnologia</remarks> public static void CriaRedirecionamentoPermanente(HttpRequest Request, System.Web.HttpResponse Response, string redirecionarDe, string redirecionarPara) { var fullFixedURI = Request.RawUrl; fullFixedURI = fullFixedURI.ToLower(); if (fullFixedURI.Contains(redirecionarDe.ToLower())) { // string substrUri = string.Empty; string redirectURI; var indexOfAssets = fullFixedURI.ToLower().IndexOf(redirecionarDe.ToLower()); var urlRoot = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath; // substrUri = fullFixedURI.ToLower().Substring(indexOfAssets, fullFixedURI.Length - indexOfAssets); substrUri = substrUri.Replace(redirecionarDe.ToLower(), "/" + redirecionarPara.ToLower()); // redirectURI = urlRoot + substrUri; // Response.Redirect(redirectURI); } }
private static void doRender(string PlaceholderType, string RenderFunction, HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] subParamsArray, string templateFilename) { try { // Render() parameters are set in BaseCmsPlaceholder PlaceholderUtils.InvokePlaceholderFunction(PlaceholderType, RenderFunction, new object[] { writer, page, identifier, langToRenderFor, subParamsArray }); } catch (Exception ex) { if (ex is System.Threading.ThreadAbortException) { // the placeholder or control did a Response.End return; } else if (ex is CmsPageNotFoundException || ex.InnerException is CmsPageNotFoundException) { CmsContext.HandleNotFoundException(); } else if (ex is CmsPlaceholderNeedsRedirectionException || ex.InnerException is CmsPlaceholderNeedsRedirectionException) { // due to the dynamic nature of placeholders, // placeholders can not redirect on their own, so must raise an Exception to do so. if (HttpContext.Current != null && HttpContext.Current.Response != null) { System.Web.HttpResponse resp = System.Web.HttpContext.Current.Response; resp.Clear(); resp.ClearContent(); resp.ClearHeaders(); string targetUrl = (ex.InnerException as CmsPlaceholderNeedsRedirectionException).TargetUrl; resp.StatusCode = 301; // Moved Permanently resp.AddHeader("Location", targetUrl); resp.Redirect(targetUrl, true); } } else { throw new TemplateExecutionException(ex.InnerException, templateFilename, "Error in Placeholder, or Unknown Placeholder in " + PlaceholderType + " Template<p>root exception: " + ex.Message); } } } // callExternalPlaceholderRender
//public void MenuControlBehavior(System.Web.UI.WebControls.MenuEventArgs e, System.Web.HttpRequest Request,System.Web.HttpResponse Response, string lastname, string firstname) public void MenuControlBehavior(System.Web.UI.WebControls.MenuEventArgs e, System.Web.HttpRequest Request, System.Web.HttpResponse Response) { var newSiteBaseUrl = ConfigurationManager.AppSettings["NewSiteBaseUrl"]; Boolean LimitAccess = false; Boolean fullaccess = false; Boolean partialaccess = false; string AccessLevel = "1"; GlobalSecuity RestrictAccess = new GlobalSecuity(); //Ryan C Manners.6/10/11. if (e.Item.Text == "New Coming Features") { //Response.Redirect("Volunteers.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); //e.Item.NavigateUrl = ""; } else if (e.Item.Text == "Main Menu") { //if (LimitAccess) //{ // Response.Redirect("ErrorAccess.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"]); //} //else //{ Response.Redirect("MenuTest.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); //} } else if (e.Item.Text == "Volunteer Directory") { //LimitAccess = RestrictAccess.RestrictAccess(ref AccessLevel, ref partialaccess, ref fullaccess, lastname, firstname,"Volunteers"); //if (LimitAccess) //{ // Response.Redirect("ErrorAccess.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"]); //} //else //{ Response.Redirect("Volunteers.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); //} } else if (e.Item.Text == "Student Directory") { //LimitAccess = RestrictAccess.RestrictAccess(ref AccessLevel, ref partialaccess, ref fullaccess, lastname, firstname,"uifadmin2"); //if (LimitAccess) //{ // Response.Redirect("ErrorAccess.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); //} //else //{ Response.Redirect("uifadmin2.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); //} } else if (e.Item.Text == "RSVP Gospel Tracking") { Response.Redirect("RSVPGospelTracking.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Impact Urban Schools") { Response.Clear(); Response.Redirect("ImpactUrbanSchools.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&StudentLastName=&StudentFirstName=" + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Enter Student Attendance") { Response.Redirect("StudentAttendance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "View Student Attendance") { Response.Redirect("ViewStudentAttendance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Edit Student Attendance") { //Response.Redirect("StudentAttendance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Enter Volunteer Attendance") { Response.Redirect("VolunteerAttendance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "View Volunteer Attendance") { Response.Redirect("ViewVolunteerAttendance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Edit Volunteer Attendance") { //Response.Redirect("StudentAttendance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Athletics") { Response.Redirect("AthleticsProgramMaintenance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "PerformingArtsAcademy") { Response.Redirect("PerformingArtsAcademy.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "MSHS Choir") { Response.Redirect("MSHSChoir.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Childrens Choir") { Response.Redirect("ChildrensChoir.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Singers") { Response.Redirect("Singers.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Shakes") { Response.Redirect("Shakes.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "CoreKids") { Response.Redirect("CoreKidsProgram.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Options") { Response.Redirect(newSiteBaseUrl + "Options"); } else if (e.Item.Text == "KRA Reports") { Response.Redirect("KRA.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Systems Billboard") { Response.Redirect("SystemEnhancementsBulletin.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "DiscipleshipMentor") { Response.Redirect("DiscipleshipMentorProgram.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&StudentLastName=" + "&StudentFirstName=" + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "MSHS Choir") { Response.Redirect("MSHSChoir.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "SummerDay Camp") { Response.Redirect("SummerDayCamp.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Childrens Choir") { Response.Redirect("ChildrensChoir.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Student Search/Queries") { Response.Redirect("StudentAttendanceReporting.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Volunteer Search/Queries") { Response.Redirect("VolunteerSearchQueries.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Volunteer Background Details") { Response.Redirect("VolunteerDetails.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&VolunteerLastName=" + "&VolunteerFirstName=" + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Mailing Lists") { Response.Redirect("MailingLists.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Attendance History Information") { Response.Redirect("AttendanceHistoryInformation.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "StudentProgram Maintenance") { Response.Redirect("AthleticsProgramMaintenance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "VolunteerProgram Maintenance") { Response.Redirect("AthleticsVolunteerMaintenance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Student Attendance History") { Response.Redirect("AthleticsAttendanceHistory.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Volunteer Attendance History") { Response.Redirect("VolunteerAttendanceHistory.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "AthleticsProgramSection Maintenance") { Response.Redirect("AthleticsProgramSectionMaintenance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Education AdminMaintenance") { Response.Redirect("EducationProgramSectionMaintenance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Admin Functions") { Response.Redirect("AdminFunctions.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "Program Admin Maintenance") { Response.Redirect("PerformingArtsProgramSectionMaintenance.aspx?Security=Good&lastname=" + Request.QueryString["lastname"] + "&firstname=" + Request.QueryString["firstname"] + "&Dept=" + Request.QueryString["Dept"]); } else if (e.Item.Text == "LogOut") { Response.Redirect(newSiteBaseUrl + "Account/Logout"); } }
public override void Redirect(string url) { _httpResponse.Redirect(url); }
public static void Redirect(HttpResponse httpRes, string url, bool endResponse, string msg) { string urlMsg; if (msg.Length > 0) urlMsg = string.Format("{0}?Msg={1}", url, msg); else urlMsg = url; httpRes.Redirect(urlMsg, endResponse); }
public void Methods_Deny_Unrestricted () { HttpResponse response = new HttpResponse (writer); response.AddCacheItemDependencies (new ArrayList ()); response.AddCacheItemDependency (String.Empty); response.AddFileDependencies (new ArrayList ()); response.AddFileDependency (fname); response.AddCacheDependency (new CacheDependency[0]); response.AddCacheItemDependencies (new string [0]); response.AddFileDependencies (new string [0]); try { response.AppendCookie (new HttpCookie ("mono")); } catch (NullReferenceException) { // ms } try { Assert.IsNull (response.ApplyAppPathModifier (null), "ApplyAppPathModifier"); } catch (NullReferenceException) { // ms } try { response.Clear (); } catch (NullReferenceException) { // ms } try { response.ClearContent (); } catch (NullReferenceException) { // ms } try { response.ClearHeaders (); } catch (NullReferenceException) { // ms } try { response.Redirect ("http://www.mono-project.com"); } catch (NullReferenceException) { // ms } try { response.Redirect ("http://www.mono-project.com", false); } catch (NullReferenceException) { // ms } try { response.SetCookie (new HttpCookie ("mono")); } catch (NullReferenceException) { // ms } response.Write (String.Empty); response.Write (Char.MinValue); response.Write (new char[0], 0, 0); response.Write (this); response.WriteSubstitution (new HttpResponseSubstitutionCallback (Callback)); response.Flush (); response.Close (); try { response.End (); } catch (NullReferenceException) { // ms } }
public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; if (HostingEnvironment.HaveCustomVPP) { VirtualFile vf = null; VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider; string vpath = request.FilePath; if (vpp.FileExists(vpath)) { vf = vpp.GetFile(vpath); } if (vf == null) { throw new HttpException(404, "Path '" + vpath + "' was not found.", vpath); } response.ContentType = MimeTypes.GetMimeType(vpath); response.TransmitFile(vf, true); return; } string fileName = request.PhysicalPath; FileInfo fi = new FileInfo(fileName); if (!fi.Exists || !ValidFileName(fileName)) { throw new HttpException(404, "Path '" + request.FilePath + "' was not found.", request.FilePath); } if ((fi.Attributes & FileAttributes.Directory) != 0) { response.Redirect(request.Path + '/'); return; } string strHeader = request.Headers ["If-Modified-Since"]; try { if (strHeader != null) { DateTime dtIfModifiedSince = DateTime.ParseExact(strHeader, "r", null); DateTime ftime; ftime = fi.LastWriteTime.ToUniversalTime(); if (ftime <= dtIfModifiedSince) { response.ContentType = MimeTypes.GetMimeType(fileName); response.StatusCode = 304; return; } } } catch { } try { DateTime lastWT = fi.LastWriteTime.ToUniversalTime(); response.AddHeader("Last-Modified", lastWT.ToString("r")); response.ContentType = MimeTypes.GetMimeType(fileName); response.TransmitFile(fileName, true); } catch (Exception) { throw new HttpException(403, "Forbidden."); } }
public override void Redirect(string url) { w.Redirect(url); }
/// <summary> /// Set the cookies required by Matter Center app /// </summary> /// <param name="request">Request Object</param> /// <param name="response">Response Object</param> /// <param name="redirectURL">Redirect URL</param> /// <param name="constantFileObject">Object to fetch constants from resource file</param> /// <param name="constantFile">Name of the app specific resource file</param> /// <param name="isTokenRequestFailure">Parameter to check if Token Request failed or not</param> /// <returns>Refresh Token</returns> private static string SetMatterCenterCookie(HttpRequest request, HttpResponse response, string redirectURL, string constantFileObject, string constantFile, bool isTokenRequestFailure) { string refreshToken = string.Empty; //// Redirect in case of the App Token is not set by SharePoint if (string.IsNullOrEmpty(request.Form[UIConstantStrings.SPAppToken])) { response.Redirect(redirectURL, false); } else { //// Regenerate the refresh token from Sp App Token refreshToken = UIUtility.GetRefreshToken(request.Form[UIConstantStrings.SPAppToken]); if (isTokenRequestFailure) { //// Reset the cookie with new value of refresh token response.Cookies[UIConstantStrings.refreshToken].Value = refreshToken; } else { HttpCookie data = new HttpCookie(UIConstantStrings.refreshToken, refreshToken); data.Secure = true; data.Expires = DateTime.Now.AddHours(Convert.ToInt32(UIConstantStrings.RefreshTokenCookieExpiration, CultureInfo.InvariantCulture)); response.Cookies.Add(data); SetResponse(request, response, constantFileObject, constantFile, refreshToken); response.Write(UIUtility.SetSharePointResponse(refreshToken)); } } return refreshToken; }
private static FileInfo GetFileInfo(string virtualPathWithPathInfo, string physicalPath, HttpResponse response) { // Check whether the file exists if (!FileUtil.FileExists(physicalPath)) { throw new HttpException(HttpStatus.NotFound, SR.GetString(SR.File_does_not_exist)); } // To prevent the trailing dot problem, error out all file names with trailing dot. if (physicalPath[physicalPath.Length - 1] == '.') { throw new HttpException(HttpStatus.NotFound, SR.GetString(SR.File_does_not_exist)); } FileInfo fileInfo; try { fileInfo = new FileInfo(physicalPath); } catch (IOException ioEx) { if (!HttpRuntime.HasFilePermission(physicalPath)) { throw new HttpException(HttpStatus.NotFound, SR.GetString(SR.Error_trying_to_enumerate_files)); } else { throw new HttpException(HttpStatus.NotFound, SR.GetString(SR.Error_trying_to_enumerate_files), ioEx); } } catch (SecurityException secEx) { if (!HttpRuntime.HasFilePermission(physicalPath)) { throw new HttpException(HttpStatus.Unauthorized, SR.GetString(SR.File_enumerator_access_denied)); } else { throw new HttpException(HttpStatus.Unauthorized, SR.GetString(SR.File_enumerator_access_denied), secEx); } } // To be consistent with IIS, we won't serve out hidden files if ((((int)fileInfo.Attributes) & ((int)FileAttributes.Hidden)) != 0) { throw new HttpException(HttpStatus.NotFound, SR.GetString(SR.File_is_hidden)); } // If the file is a directory, then it must not have a slash in // end of it (if it does have a slash suffix, then the config file // mappings are missing and we will just return 403. Otherwise, // we will redirect the client to the URL with this slash. if ((((int)fileInfo.Attributes) & ((int)FileAttributes.Directory)) != 0) { if (StringUtil.StringEndsWith(virtualPathWithPathInfo, '/')) { // Just return 403 throw new HttpException(HttpStatus.Forbidden, SR.GetString(SR.Missing_star_mapping)); } else { // Redirect to a slash suffixed URL which will be // handled by the */ handler mapper response.Redirect(virtualPathWithPathInfo + "/"); } } return(fileInfo); }
private void Redirect( HttpResponse response, string url, bool permanent ) { if ( permanent ) { response.Status = "301 Moved Permanently"; response.AddHeader( "Location", UrlPath.ResolveUrl( url ) ); response.End(); } else { response.Redirect( UrlPath.ResolveUrl( url ), true ); } }
//会员注册 public void Member_Register() { string member_nickname = tools.CheckStr(tools.NullStr(Request.Form["member_nickname"]).Trim()); string member_email = tools.CheckStr(tools.NullStr(Request.Form["member_email"]).Trim()); string member_password = tools.CheckStr(tools.NullStr(Request.Form["member_password"]).Trim()); string member_password_confirm = tools.CheckStr(tools.NullStr(Request.Form["member_password_confirm"]).Trim()); string verifycode = tools.CheckStr(tools.NullStr(Request.Form["verifycode"])); int Isagreement = tools.CheckInt(tools.NullStr(Request.Form["checkbox_agreement"])); int Member_Type = tools.CheckInt(tools.NullStr(Request["Member_Type"])); //string member_mobile = tools.CheckStr(tools.NullStr(Request.Form["member_mobile"])); int DefaultGrade = 1; string Member_State = "", Member_City = "", Member_County = "", Member_Name = "", Member_StreetAddress = "", Member_Phone_Number = "", member_mobile = "", U_Member_CompanyName = "", U_Member_CompanyUrl = ""; int U_Member_Department = 0, U_Member_CompanyKind = 0, U_Member_CompanyVocation = 0, U_Member_MenAmount = 0, U_Member_BuyType = 0; MemberGradeInfo member_grade = GetMemberDefaultGrade(); if (member_grade != null) { DefaultGrade = member_grade.Member_Grade_ID; } if (verifycode != Session["Trade_Verify"].ToString() && verifycode.Length == 0) { pub.Msg("error", "验证码输入错误", "验证码输入错误", false, "{back}"); } if (member_nickname.Length > 0) { if (Check_Member_Nickname(member_nickname)) { pub.Msg("error", "该昵称已被使用", "该昵称已被使用。请使用另外一个昵称进行注册", false, "{back}"); } } else { pub.Msg("error", "昵称无效", "请输入有效的昵称", false, "{back}"); } if (tools.CheckEmail(member_email) == false) { pub.Msg("error", "邮件地址无效", "请输入有效的邮件地址", false, "{back}"); } else { if (Check_Member_Email(member_email)) { pub.Msg("error", "该邮件地址已被使用", "该邮件地址已被使用。请使用另外一个邮件地址进行注册", false, "{back}"); } } if (CheckSsn(member_password) == false) { pub.Msg("error", "密码包含特殊字符", "密码包含特殊字符,只接受A-Z,a-z,0-9,不要输入空格", false, "{back}"); } else { if (member_password.Length < 6 || member_password.Length > 20) { pub.Msg("error", "请输入6~20位密码", "请输入6~20位密码", false, "{back}"); } } if (member_password_confirm != member_password) { pub.Msg("error", "两次密码输入不一致", "两次密码输入不一致,请重新输入", false, "{back}"); } if (Member_Type == 1) { Member_Name = tools.CheckStr(tools.NullStr(Request["Member_Name"])); if (Member_Name == "") { pub.Msg("error", "信息不能为空", "联系人姓名不能为空", false, "{back}"); } U_Member_Department = tools.CheckInt(tools.NullStr(Request["Member_Department"])); if (U_Member_Department == 0) { pub.Msg("error", "信息提示", "请选择联系人所在部门", false, "{back}"); } Member_Phone_Number = tools.CheckStr(tools.NullStr(Request["Member_Phone_Number"])); if (Member_Phone_Number == "") { pub.Msg("error", "信息提示", "请输入联系人的固定电话", false, "{back}"); } else if (pub.Checkmobile(Member_Phone_Number) == false) { pub.Msg("error", "信息提示", "电话格式错误,请重新输入!", false, "{back}"); } member_mobile = tools.CheckStr(tools.NullStr(Request["member_mobile"])); U_Member_CompanyName = tools.CheckStr(tools.NullStr(Request["U_Member_CompanyName"])); if (U_Member_CompanyName == "") { pub.Msg("error", "信息提示", "请输入公司名称!", false, "{back}"); } Member_State = tools.CheckStr(tools.NullStr(Request["Member_State"])); Member_City = tools.CheckStr(tools.NullStr(Request["Member_City"])); Member_County = tools.CheckStr(tools.NullStr(Request["Member_County"])); if (Member_County == "0") { pub.Msg("error", "信息提示", "请选择公司所在地!", false, "{back}"); } Member_StreetAddress = tools.CheckStr(tools.NullStr(Request["Member_StreetAddress"])); U_Member_BuyType = tools.CheckInt(tools.NullStr(Request["Buy_Type"])); if (U_Member_BuyType == 0) { pub.Msg("error", "信息提示", "请选择购买类型/用途!", false, "{back}"); } U_Member_CompanyUrl = tools.CheckStr(tools.NullStr(Request["U_Member_CompanyUrl"])); U_Member_MenAmount = tools.CheckInt(tools.NullStr(Request["Men_Amount"])); U_Member_CompanyVocation = tools.CheckInt(tools.NullStr(Request["Company_Vocation"])); U_Member_CompanyKind = tools.CheckInt(tools.NullStr(Request["Company_Kind"])); } if (Isagreement != 1) { pub.Msg("error", "您需要接受用户注册协议", "要完成注册,您需要接受用户注册协议", false, "{back}"); } MemberInfo member = new MemberInfo(); member.Member_ID = 0; member.Member_Email = member_email; member.Member_Emailverify = 0; member.Member_LoginMobile = ""; member.Member_LoginMobileverify = 1; member.Member_NickName = member_nickname; member.Member_Password = encrypt.MD5(member_password); member.Member_VerifyCode = pub.Createvkey(); member.Member_LoginCount = 1; member.Member_LastLogin_IP = Request.ServerVariables["remote_addr"]; member.Member_LastLogin_Time = DateTime.Now; member.Member_CoinCount = 0; member.Member_CoinRemain = 0; member.Member_Addtime = DateTime.Now; member.Member_Trash = 0; member.Member_Grade = DefaultGrade; member.Member_Account = 0; member.Member_Frozen = 0; member.Member_AllowSysEmail = 1; member.Member_Site = "CN"; member.Member_Source = Session["customer_source"].ToString(); //member.U_Member_Type = Member_Type; //添加会员基本信息 if (MyMember.AddMember(member, pub.CreateUserPrivilege("5d071ec6-31d8-4960-a77d-f8209bbab496"))) { MemberInfo memberinfo = GetMemberInfoByEmail(member_email); if (memberinfo != null) { //添加详细信息 MemberProfileInfo profile = new MemberProfileInfo(); profile.Member_Profile_MemberID = memberinfo.Member_ID; profile.Member_Name = ""; profile.Member_Sex = -1; profile.Member_StreetAddress = ""; profile.Member_County = "0"; profile.Member_City = "0"; profile.Member_State = "0"; profile.Member_Country = "CN"; profile.Member_Zip = ""; profile.Member_Phone_Countrycode = "+86"; profile.Member_Phone_Areacode = ""; profile.Member_Phone_Number = ""; profile.Member_Mobile = ""; if (Member_Type == 1) { profile.Member_County = Member_County; profile.Member_City = Member_City; profile.Member_State = Member_State; profile.Member_Name = Member_Name; profile.Member_Phone_Number = Member_Phone_Number; profile.Member_Mobile = member_mobile; //profile.U_Member_BuyType = U_Member_BuyType; //profile.U_Member_CompanyName = U_Member_CompanyName; //profile.U_Member_Department = U_Member_Department; //profile.Member_StreetAddress = Member_StreetAddress; //profile.U_Member_CompanyKind = U_Member_CompanyKind; //profile.U_Member_CompanyUrl = U_Member_CompanyUrl; //profile.U_Member_CompanyVocation = U_Member_CompanyVocation; //profile.U_Member_MenAmount = U_Member_MenAmount; } MyMember.AddMemberProfile(profile, pub.CreateUserPrivilege("5d071ec6-31d8-4960-a77d-f8209bbab496")); Member_Log(memberinfo.Member_ID, "会员注册"); //MyEmail.DelU_EmailNotifyRequestByEmail(memberinfo.Member_Email, pub.CreateUserPrivilege("83b084ee-1f49-4da0-b28c-8cdaaec1c193")); Session["member_id"] = memberinfo.Member_ID; Session["member_email"] = memberinfo.Member_Email; Session["member_nickname"] = memberinfo.Member_NickName; Session["member_logined"] = true; Session["member_emailverify"] = true; Session["member_logincount"] = memberinfo.Member_LoginCount + 1; Session["member_lastlogin_time"] = memberinfo.Member_LastLogin_Time; Session["member_lastlogin_ip"] = memberinfo.Member_LastLogin_IP; Session["member_coinremain"] = memberinfo.Member_CoinRemain; Session["member_coincount"] = memberinfo.Member_CoinCount; Session["member_grade"] = memberinfo.Member_Grade; Session["Member_AllowSysEmail"] = memberinfo.Member_AllowSysEmail; // Session["Member_Type"] = memberinfo.U_Member_Type; Response.Cookies["member_email"].Expires = DateTime.Now.AddDays(365); Response.Cookies["member_email"].Value = memberinfo.Member_Email; //member_register_sendemailverify(memberinfo.Member_Email, memberinfo.Member_VerifyCode); //if (memberinfo.Member_Emailverify == 0) //{ Session["member_emailverify"] = memberinfo.Member_Emailverify; //Response.Redirect("/member/emailverify.aspx"); //} //else //{ //Response.Redirect("/member/index.aspx"); //} if (Session["url_after_login"] == null) { Session["url_after_login"] = ""; } if (tools.NullStr(Session["url_after_login"].ToString()) != "") { Response.Redirect(Session["url_after_login"].ToString()); } else { Response.Redirect("/member/index.aspx"); } } else { pub.Msg("error", "错误信息", "用户注册失败,请稍后再试!", true, "/index.aspx"); } } else { pub.Msg("error", "错误信息", "用户注册失败,请稍后再试!", true, "/index.aspx"); } }
public void ProcessRequest(HttpContext context) { System.Web.HttpRequest Request = context.Request; System.Web.HttpResponse Response = context.Response; int itemId = -1, qty = 1; if (Request.Form["ItemId"] != null) { try { itemId = Int32.Parse(Request.Form["ItemId"]); } catch { } } else { if (Request.QueryString["ItemId"] != null) { try { itemId = Int32.Parse(Request.QueryString["ItemId"]); } catch { } } } if (Request.Form["QTY"] != null) { try { qty = Int32.Parse(Request.Form["QTY"]); } catch { } } else { if (Request.QueryString["QTY"] != null) { try { qty = Int32.Parse(Request.QueryString["QTY"]); } catch { } } } lw.ShoppingCart.ShoppingCart sCart = new lw.ShoppingCart.ShoppingCart(); sCart.Empty(); string optionsKey = Request["Options"]; optionsKey = String.IsNullOrEmpty(optionsKey)? "": optionsKey; ChoicesMgr cMgr = new ChoicesMgr(); if (optionsKey == "") { DataTable dt = cMgr.GetItemOptions(itemId); if (dt.Rows.Count > 0) { Config cfg = new Config(); ItemsMgr iMgr = new ItemsMgr(); DataRow item = iMgr.GetItem(itemId); string ProductDetailsFolder = cfg.GetKey("ProductDetailsFolder"); string red = string.Format("{2}/{1}/{0}.aspx", item["UniqueName"], ProductDetailsFolder, WebContext.Root ); Response.Redirect(red + "?err=" + lw.CTE.Errors.SelectItemOptions); } } sCart.AddItem(itemId, qty, optionsKey, "", ""); Response.Redirect(WebContext.Root + "/shopping-cart/"); }
///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// public void ProcessRequest(HttpContext context) { FileInfo file; HttpRequest request = context.Request; HttpResponse response = context.Response; string FileName = request.PhysicalPath; Util.Debug.Trace("GET", "Path = " + request.Path); Util.Debug.Trace("GET", "File Name = " + FileName); // // Check whether the file exists // if (!FileUtil.FileExists(FileName)) { throw new HttpException(HttpStatus.NotFound, HttpRuntime.FormatResourceString(SR.File_does_not_exist)); } try { file = new FileInfo(FileName); } catch (IOException ioEx) { if (!HttpRuntime.HasFilePermission(FileName)) { throw new HttpException(HttpStatus.NotFound, HttpRuntime.FormatResourceString(SR.Error_trying_to_enumerate_files)); } else { throw new HttpException(HttpStatus.NotFound, HttpRuntime.FormatResourceString(SR.Error_trying_to_enumerate_files), ioEx); } } catch (SecurityException secEx) { if (!HttpRuntime.HasFilePermission(FileName)) { throw new HttpException(HttpStatus.Unauthorized, HttpRuntime.FormatResourceString(SR.File_enumerator_access_denied)); } else { throw new HttpException(HttpStatus.Unauthorized, HttpRuntime.FormatResourceString(SR.File_enumerator_access_denied), secEx); } } // // To be consistent with IIS, we won't serve out hidden files // if ((((int)file.Attributes) & ((int)FileAttributes.Hidden)) != 0) { throw new HttpException(HttpStatus.NotFound, HttpRuntime.FormatResourceString(SR.File_is_hidden)); } // // To prevent the trailing dot problem, error out all file names with trailing dot. // if (FileName[FileName.Length - 1] == '.') { throw new HttpException(HttpStatus.NotFound, HttpRuntime.FormatResourceString(SR.File_does_not_exist)); } // // If the file is a directory, then it must not have a slash in // end of it (if it does have a slash suffix, then the config file // mappings are missing and we will just return 403. Otherwise, // we will redirect the client to the URL with this slash. // if ((((int)file.Attributes) & ((int)FileAttributes.Directory)) != 0) { if (request.Path.EndsWith("/")) { // // Just return 403 // throw new HttpException(HttpStatus.Forbidden, HttpRuntime.FormatResourceString(SR.Missing_star_mapping)); } else { // // Redirect to a slash suffixed URL which will be // handled by the */ handler mapper // response.Redirect(request.Path + "/"); } } else { DateTime lastModified; string strETag; // // Determine Last Modified Time. We might need it soon // if we encounter a Range: and If-Range header // lastModified = new DateTime(file.LastWriteTime.Year, file.LastWriteTime.Month, file.LastWriteTime.Day, file.LastWriteTime.Hour, file.LastWriteTime.Minute, file.LastWriteTime.Second, 0); // // Generate ETag // strETag = GenerateETag(context, lastModified); // // OK. Send the static file out either // entirely or send out the requested ranges // try { BuildFileItemResponse(context, FileName, file.Length, lastModified, strETag); } catch (Exception e) { // // Check for ERROR_ACCESS_DENIED and set the HTTP // status such that the auth modules do their thing // if ((e is ExternalException) && IsSecurityError(((ExternalException)e).ErrorCode)) { throw new HttpException(HttpStatus.Unauthorized, HttpRuntime.FormatResourceString(SR.Resource_access_forbidden)); } } context.Response.Cache.SetLastModified(lastModified); context.Response.Cache.SetETag(strETag); // // We will always set Cache-Control to public // context.Response.Cache.SetCacheability(HttpCacheability.Public); } }
//广告推广审核 public void ADApply_Audit_Edit(int status) { string ad_id = tools.CheckStr(Request["ad_id"]); if (ad_id == "") { Public.Msg("error", "错误信息", "请选择要操作的申请信息", false, "{back}"); return; } ADPositionInfo AdPositionEntity = null; if (tools.Left(ad_id, 1) == ",") { ad_id = ad_id.Remove(0, 1); } ProductDenyReasonInfo reasoninfo; QueryInfo Query = new QueryInfo(); Query.PageSize = tools.CheckInt(Request["rows"]); Query.CurrentPage = tools.CheckInt(Request["page"]); Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.Ad_ID", "in", ad_id)); Query.ParamInfos.Add(new ParamInfo("AND", "str", "ADInfo.Ad_Site", "=", Public.GetCurrentSite())); Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.U_Ad_Audit", "=", "0")); Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.U_Ad_Advertiser", ">", "0")); Query.OrderInfos.Add(new OrderInfo("ADInfo.Ad_ID", "DESC")); IList <ADInfo> entitys = MyAD.GetADs(Query, Public.GetUserPrivilege()); if (entitys != null) { foreach (ADInfo entity in entitys) { if (status == 1) { AdPositionEntity = Myposition.GetAD_PositionByValue(entity.Ad_Kind, Public.GetUserPrivilege()); if (AdPositionEntity == null) { AdPositionEntity = new ADPositionInfo(); } double DeductMoney = ((entity.Ad_EndDate - entity.Ad_StartDate).Days + 1) * AdPositionEntity.U_Ad_Position_Price; if (supplier.GetSupplierAdvAccount(entity.U_Ad_Advertiser) >= DeductMoney) { supplier.Supplier_Account_Log(entity.U_Ad_Advertiser, 2, Math.Round(0 - DeductMoney, 2), "广告服务费"); } else { Public.Msg("error", "错误信息", "账户余额不足", false, "{back}"); break; } } entity.U_Ad_Audit = status; MyAD.EditAD(entity, Public.GetUserPrivilege()); } } Response.Redirect("/ad/ad_apply.aspx"); }
public void EditProductReview(string action) { int review_id = tools.CheckInt(Request.QueryString["review_id"]); int Review_count = 0; int Star_count = 0; int reviews_count = 0; double Review_Average = 0; if (review_id > 0) { ProductReviewInfo review = Myreview.GetProductReviewByID(review_id, Public.GetUserPrivilege()); if (review != null) { int Product_Review_ID = review.Product_Review_ID; int Product_Review_MemberID = review.Product_Review_MemberID; int Product_Review_ProductID = review.Product_Review_ProductID; DateTime Product_Review_Addtime = review.Product_Review_Addtime; string Product_Review_Content = review.Product_Review_Content; int Product_Review_IsBuy = review.Product_Review_IsBuy; int Product_Review_IsRecommend = review.Product_Review_IsRecommend; int Product_Review_IsShow = review.Product_Review_IsShow; int Product_Review_Star = review.Product_Review_Star; string Product_Review_Subject = review.Product_Review_Subject; int Product_Review_Useful = review.Product_Review_Useful; int Product_Review_Useless = review.Product_Review_Useless; int Product_Review_IsGift = review.Product_Review_IsGift; int Product_Review_IsView = review.Product_Review_IsView; switch (action) { case "recommend": Product_Review_IsRecommend = 1; break; case "recommendcancel": Product_Review_IsRecommend = 0; break; case "show": Product_Review_IsShow = 1; break; case "showcancel": Product_Review_IsShow = 0; break; case "reviewview": Product_Review_IsView = 1; break; } ProductReviewInfo entity = new ProductReviewInfo(); entity.Product_Review_ID = Product_Review_ID; entity.Product_Review_ProductID = Product_Review_ProductID; entity.Product_Review_MemberID = Product_Review_MemberID; entity.Product_Review_Star = Product_Review_Star; entity.Product_Review_Subject = Product_Review_Subject; entity.Product_Review_Content = Product_Review_Content; entity.Product_Review_Useful = Product_Review_Useful; entity.Product_Review_Useless = Product_Review_Useless; entity.Product_Review_Addtime = Product_Review_Addtime; entity.Product_Review_IsShow = Product_Review_IsShow; entity.Product_Review_IsBuy = Product_Review_IsBuy; entity.Product_Review_IsRecommend = Product_Review_IsRecommend; if (action == "show") { entity.Product_Review_IsGift = 1; } else { entity.Product_Review_IsGift = Product_Review_IsGift; } entity.Product_Review_Site = Public.GetCurrentSite(); if (Myreview.EditProductReview(entity, Public.GetUserPrivilege())) { ProductInfo productinfo = Myproduct.GetProductByID(Product_Review_ProductID, Public.GetUserPrivilege()); if (productinfo != null) { Review_Average = productinfo.Product_Review_Average; reviews_count = productinfo.Product_Review_Count; } switch (action) { case "show": Review_count = Myreview.GetProductReviewValidCount(Product_Review_ProductID); if (Review_count > 0) { Review_Average = ((Review_Average * (Review_count - 1)) + Product_Review_Star) / Review_count; Myreview.UpdateProductReviewINfo(Product_Review_ProductID, Review_Average, reviews_count, Review_count); } ProductReviewConfigInfo config = GetProductReviewConfig(); if (config != null) { if (config.Product_Review_giftcoin > 0 && Product_Review_MemberID > 0 && Product_Review_IsGift == 0) { member.Member_Coin_AddConsume(config.Product_Review_giftcoin, "发表评论赠送积分", Product_Review_MemberID, true); } } break; case "showcancel": Review_count = Myreview.GetProductReviewValidCount(Product_Review_ProductID); Star_count = Myreview.GetProductStarCount(Product_Review_ProductID); if (Review_count > 0) { Review_Average = Star_count / Review_count; Myreview.UpdateProductReviewINfo(Product_Review_ProductID, Review_Average, reviews_count, Review_count); } else { Myreview.UpdateProductReviewINfo(Product_Review_ProductID, 0, reviews_count, 0); } break; case "recommend": ProductReviewConfigInfo configreview = GetProductReviewConfig(); if (configreview != null) { if (configreview.Product_Review_Recommendcoin > 0 && Product_Review_MemberID > 0) { member.Member_Coin_AddConsume(configreview.Product_Review_Recommendcoin, "评论推荐赠送积分", Product_Review_MemberID, true); } } break; } Response.Redirect("Product_Review_list.aspx"); } else { Response.Redirect("Product_Review_list.aspx"); } } } }
private static bool CheckForTabExternalForwardOrRedirect(HttpContext context, ref UrlAction result, HttpResponse response, FriendlyUrlSettings settings, Guid parentTraceId) { bool finished = false; HttpRequest request = null; if (context != null) { request = context.Request; } try { //check for external forwarding or a permanent redirect request //592 : check for permanent redirect (823 : moved location from 'checkForRedirects') if (result.TabId > -1 && result.PortalId > -1 && (settings.ForwardExternalUrlsType != DNNPageForwardType.NoForward || result.Reason == RedirectReason.Tab_Permanent_Redirect)) { bool allowRedirect = !(result.RewritePath != null && result.RewritePath.ToLower().Contains("&ctl=tab")); //594 : do not redirect settings pages for external urls if (allowRedirect) { TabInfo tab; allowRedirect = CheckFor301RedirectExclusion(result.TabId, result.PortalId, false, out tab, settings); if (allowRedirect) { //772 : not redirecting file type Urls when requested. bool permanentRedirect = false; string redirectUrl = null; string cleanPath = null; bool doRedirect = false; switch (tab.TabType) { case TabType.File: //have to fudge in a portal settings object for this to work - shortcoming of LinkClick URl generation var portalSettings = new PortalSettings(result.TabId, result.PortalAlias); if (context != null) { context.Items.Add("PortalSettings", portalSettings); result.Reason = RedirectReason.File_Url; string fileUrl = Globals.LinkClick(tab.Url, tab.TabID, -1); context.Items.Remove("PortalSettings"); //take back out again, because it will be done further downstream //do a check to make sure we're not repeating the Url again, because the tabid is set but we don't want to touch //a linkclick url if (!result.OriginalPathNoAlias.EndsWith(HttpUtility.UrlDecode(fileUrl), true, CultureInfo.InvariantCulture)) { redirectUrl = fileUrl; } } if (redirectUrl != null) { doRedirect = true; } break; case TabType.Url: result.Reason = RedirectReason.Tab_External_Url; redirectUrl = tab.Url; if (redirectUrl != null) { doRedirect = true; if (settings.ForwardExternalUrlsType == DNNPageForwardType.Redirect301) { result.Action = ActionType.Redirect301; result.Reason = RedirectReason.Tab_External_Url; } else if (settings.ForwardExternalUrlsType == DNNPageForwardType.Redirect302) { result.Action = ActionType.Redirect302; result.Reason = RedirectReason.Tab_External_Url; } } break; case TabType.Tab: // if a tabType.tab is specified, it's either an external url or a permanent redirect //get the redirect path of the specific tab, as long as we have a valid request to work from if (request != null) { //get the rewrite or requested path in a clean format, suitable for input to the friendly url provider cleanPath = RewriteController.GetRewriteOrRequestedPath(result, request.Url); //727 prevent redirectLoop with do301 in querystring if (result.Action == ActionType.Redirect301 || result.Action == ActionType.Redirect302) { cleanPath = RedirectTokens.RemoveAnyRedirectTokens(cleanPath, request.QueryString); } //get the redirect Url from the friendly url provider using the tab, path and settings redirectUrl = RedirectController.GetTabRedirectUrl(tab, settings, cleanPath, result, out permanentRedirect, parentTraceId); } //check to make sure there isn't a blank redirect Url if (redirectUrl == null) { //problem : no redirect Url to redirect to //solution : cancel the redirect string message = "Permanent Redirect chosen for Tab " + tab.TabPath.Replace("//", "/") + " but forwarding Url was not valid"; RedirectController.CancelRedirect(ref result, context, settings, message); } else { //if there was a redirect Url, set the redirect action and set the type of redirect going to use doRedirect = true; if (permanentRedirect) { result.Action = ActionType.Redirect301; result.Reason = RedirectReason.Tab_Permanent_Redirect; //should be already set, anyway result.RewritePath = cleanPath; } else { //not a permanent redirect, check if the page forwarding is set if (settings.ForwardExternalUrlsType == DNNPageForwardType.Redirect301) { result.Action = ActionType.Redirect301; result.Reason = RedirectReason.Tab_External_Url; } else if (settings.ForwardExternalUrlsType == DNNPageForwardType.Redirect302) { result.Action = ActionType.Redirect302; result.Reason = RedirectReason.Tab_External_Url; } } } break; default: //only concern here is if permanent redirect is requested, but there is no external url specified if (result.Reason == RedirectReason.Tab_Permanent_Redirect) { bool permRedirect = tab.PermanentRedirect; if (permRedirect) { //problem : permanent redirect marked, but no forwarding url supplied //solution : cancel redirect string message = "Permanent Redirect chosen for Tab " + tab.TabPath.Replace("//", "/") + " but no forwarding Url Supplied"; RedirectController.CancelRedirect(ref result, context, settings, message); } } break; } //do the redirect we have specified if (doRedirect && (result.Action == ActionType.Redirect301 || result.Action == ActionType.Redirect302)) { result.FinalUrl = redirectUrl; if (result.Action == ActionType.Redirect301) { if (response != null) { //perform a 301 redirect to the external url of the tab response.Status = "301 Moved Permanently"; response.AppendHeader("X-Redirect-Reason", result.Reason.ToString().Replace("_", " ") + " Requested"); response.AddHeader("Location", result.FinalUrl); response.End(); } } else { if (result.Action == ActionType.Redirect302) { if (response != null) { //perform a 301 redirect to the external url of the tab response.AppendHeader("X-Redirect-Reason", result.Reason.ToString().Replace("_", " ") + " Requested"); response.Redirect(result.FinalUrl); } } } finished = true; } } } } } catch (ThreadAbortException) { //do nothing, a threadAbortException will have occured from using a server.transfer or response.redirect within the code block. This is the highest //level try/catch block, so we handle it here. } return finished; }
public static void RedirectToPage(this System.Web.HttpResponse response, string page) { response.Redirect(page); }
/// <summary> /// Sets response on the page. /// </summary> /// <param name="request">Request Object</param> /// <param name="response">Response Object</param> /// <param name="constantFileObject">Name of the constant file object</param> /// <param name="constantFile">Name of the constant file</param> /// <param name="globalConstantFile">Name of the global constant file</param> /// <param name="environment">Deployed on Azure flag</param> /// <param name="refreshToken">Refresh Token for client context</param> private static void SetResponse(HttpRequest request, HttpResponse response, string constantFileObject, string constantFile, string refreshToken) { bool bContainsEdit = false, isSettingsPage = false; try { bContainsEdit = request.Url.Query.Contains(UIConstantStrings.IsEdit); string url = HttpUtility.UrlDecode(request.Url.Query); if (bContainsEdit) { string clientUrl = HttpUtility.ParseQueryString(url).Get(UIConstantStrings.clientUrl); string matterName = HttpUtility.ParseQueryString(url).Get(UIConstantStrings.matterName); if (!UIUtility.GetUserAccess(refreshToken, new Uri(ConstantStrings.ProvisionMatterAppURL), request) || !UIUtility.CheckUserManagePermission(refreshToken, new Uri(clientUrl), matterName, request)) { response.Write(UIConstantStrings.EditMatterAccessDeniedMessage); response.End(); } } else if (string.Equals(constantFile, ConstantStrings.ConstantFileForSettings, StringComparison.OrdinalIgnoreCase)) { isSettingsPage = true; string clientdetails = HttpUtility.ParseQueryString(url).Get(UIConstantStrings.clientDetails); string clientUrl = string.IsNullOrWhiteSpace(clientdetails) ? UIConstantStrings.TenantUrl : clientdetails.Split(new string[] { ConstantStrings.DOLLAR + ConstantStrings.Pipe + ConstantStrings.DOLLAR }, StringSplitOptions.RemoveEmptyEntries)[0]; if (!ServiceUtility.GetUserGroup(refreshToken, new Uri(clientUrl), request)) { response.Write(string.Format(CultureInfo.InvariantCulture, UIConstantStrings.SettingsPageAccessDeniedMessage, UIConstantStrings.MatterCenterSupportEmail)); response.End(); } } else { if (string.Equals(constantFile, ConstantStrings.ConstantFileForProvision, StringComparison.OrdinalIgnoreCase)) { if (!UIUtility.GetUserAccess(refreshToken, new Uri(ConstantStrings.ProvisionMatterAppURL), request)) { response.Redirect(UIConstantStrings.ServicePathFindMatter, false); } } } response.Write(SetGlobalConfigurations("Constants", UIConstantStrings.GlobalConstants, Enumerators.ResourceFileLocation.App_GlobalResources)); response.Write(SetGlobalConfigurations(constantFile, constantFileObject, Enumerators.ResourceFileLocation.App_LocalResources)); } catch (Exception exception) { if (!bContainsEdit && !isSettingsPage) { Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, UIConstantStrings.LogTableName); } } }
//public void Flush() { _innerResponse.Flush(); } //public void Pics(string value) { _innerResponse.Pics(value); } public void Redirect(string url) { _innerResponse.Redirect(url); }