public static Task Start(HttpContext context) { IUserInfo info = BaseGlobalVariable.Current.UserInfo; WebAppSetting appSetting = WebAppSetting.WebCurrent; string url; if (info.IsLogOn) { if (string.IsNullOrEmpty(appSetting.MainPath)) { url = appSetting.HomePath; } else { url = HttpUtility.UrlEncode(AppUtil.ResolveUrl(appSetting.HomePath)); url = UriUtil.AppendQueryString(appSetting.MainPath, "StartUrl=" + url); } } else { url = appSetting.StartupPath; } url = AppUtil.ResolveUrl(url); context.Response.Redirect(url); return(Task.FromResult(0)); }
private static bool IsShowMetaData(IPageData pageData) { TkDebug.ThrowIfNoAppSetting(); WebAppSetting setting = WebAppSetting.WebCurrent; return(setting.IsDebug && !pageData.IsPost && setting.IsShowMetaData(pageData.QueryString)); }
public static bool IsShowMetaData(bool showSource, IPageData pageData) { TkDebug.ThrowIfNoAppSetting(); WebAppSetting setting = WebAppSetting.WebCurrent; return(showSource && setting.IsDebug && !pageData.IsPost && setting.IsShowMetaData(pageData.QueryString)); }
public static bool IsShowExcel(bool showSource, IPageData pageData) { TkDebug.ThrowIfNoAppSetting(); WebAppSetting setting = WebAppSetting.WebCurrent; return((pageData.Style.Style == PageStyle.List || MetaDataUtil.StartsWith(pageData.Style, "DetailList")) && showSource && setting.IsShowExcel(pageData.QueryString)); }
public OutputData Insert(IInputData input, object instance) { LogOnData data = instance.Convert <LogOnData>(); using (UserResolver resolver = new UserResolver(this)) { IUserInfo userInfo = resolver.CheckUserLogOn(data.LogOnName, data.Password, 0); if (userInfo == null) { } var response = WebGlobalVariable.Response; CookieOptions options = new CookieOptions { Expires = new DateTimeOffset(DateTime.Now.AddDays(30)) }; response.Cookies.Append(COOKIE_NAME, data.LogOnName, options); options = new CookieOptions { Expires = new DateTimeOffset(JWTUtil.CalcValidTime()) }; string token = JWTUtil.CreateEncodingInfo(userInfo); response.Cookies.Append(JWTUtil.COOKIE_NAME, token, options); //CookieUserInfo cookieInfo = new CookieUserInfo(data, userInfo); //cookie = new HttpCookie(RightConst.USER_INFO_COOKIE_NAME, cookieInfo.Encode()) //{ // Expires = GetExpireDate() //}; //response.Cookies.Set(cookie); WebSuccessResult result; string retUrl = input.QueryString["RetURL"]; if (!string.IsNullOrEmpty(retUrl)) { result = new WebSuccessResult(retUrl); } else { WebAppSetting appSetting = WebAppSetting.WebCurrent; if (string.IsNullOrEmpty(appSetting.MainPath)) { result = new WebSuccessResult(appSetting.HomePath); } else { string url = HttpUtility.UrlEncode(appSetting.HomePath); string mainUrl = UriUtil.AppendQueryString(appSetting.MainPath, "StartUrl=" + url); result = new WebSuccessResult(mainUrl); } } return(OutputData.CreateToolkitObject(result)); } }
public AliyunOSSUploadInfo(IFormFile file) { TkDebug.ThrowIfNoAppSetting(); FileSize = (int)file.Length; ContentType = file.ContentType; FileName = Path.GetFileName(file.FileName); WebAppSetting appsetting = WebAppSetting.WebCurrent; string newFileName = Guid.NewGuid().ToString(); TempFile = new FileConfig(AliyunOSSSetting.Current.TempBucketName, newFileName); ServerPath = TempFile.ToString(); WebPath = WebUtil.ResolveUrl(TempFile.AccessUrl); }
public OutputData Insert(IInputData input, object instance) { LogOnData data = instance.Convert <LogOnData>(); using (UserResolver resolver = new UserResolver(this)) { IUserInfo userInfo = resolver.CheckUserLogOn(data.LogOnName, data.Password, 0); if (userInfo == null) { } WebGlobalVariable.SessionGbl.AppRight.Initialize(userInfo); var response = WebGlobalVariable.Response; HttpCookie cookie = new HttpCookie(COOKIE_NAME, data.LogOnName) { Expires = DateTime.Now.AddDays(30) }; response.Cookies.Set(cookie); CookieUserInfo cookieInfo = new CookieUserInfo(data, userInfo); cookie = new HttpCookie(RightConst.USER_INFO_COOKIE_NAME, cookieInfo.Encode()) { Expires = GetExpireDate() }; response.Cookies.Set(cookie); WebSuccessResult result; var request = WebGlobalVariable.Request; string retUrl = request.QueryString["RetURL"]; if (!string.IsNullOrEmpty(retUrl)) { result = new WebSuccessResult(retUrl); } else { WebAppSetting appSetting = WebAppSetting.WebCurrent; if (string.IsNullOrEmpty(appSetting.MainPath)) { result = new WebSuccessResult(appSetting.HomePath); } else { string url = HttpUtility.UrlEncode(appSetting.HomePath); string mainUrl = UriUtil.AppendQueryString(appSetting.MainPath, "StartUrl=" + url); result = new WebSuccessResult(mainUrl); } } return(OutputData.CreateToolkitObject(result)); } }
public WebUploadInfo(IFormFile file) { TkDebug.ThrowIfNoAppSetting(); FileSize = (int)file.Length; ContentType = file.ContentType; FileName = Path.GetFileName(file.FileName); WebAppSetting appsetting = WebAppSetting.WebCurrent; string newFileName = Guid.NewGuid() + Path.GetExtension(FileName); ServerPath = Path.Combine(appsetting.UploadTempPath, newFileName); string urlPath = UriUtil.TextCombine(appsetting.UploadTempVirtualPath, newFileName); WebPath = AppUtil.ResolveUrl(urlPath); }
public ActionResult Edit(string id, string value) { try { var webConfig = new WebAppSetting(); webConfig.Modify(id, value); return(RedirectToAction("Index")); } catch (Exception e) { ModelState.AddModelError("", e.Message); } Edit(id); return(View()); }
public HomeController(IOptions <WebAppSetting> webSetting) { _webSetting = webSetting.Value; }