public override void webExecute( ) { if (initialized == 0) { createObjects(); initialize(); } INITWEB( ); if (!isAjaxCallMode( )) { MasterPageObj = (GXMasterPage)ClassLoader.GetInstance("appmasterpage", "GeneXus.Programs.appmasterpage", new Object[] { new GxContext(context.handle, context.DataStores, context.HttpContext) }); MasterPageObj.setDataArea(this, false); MasterPageObj.webExecute(); if (context.isAjaxRequest( )) { enableOutput(); if (!context.isAjaxRequest( )) { context.GX_webresponse.AppendHeader("Cache-Control", "max-age=0"); } if (String.IsNullOrEmpty(StringUtil.RTrim(context.wjLoc))) { context.GX_webresponse.AddString((String)(context.getJSONResponse( ))); } else { context.Redirect(context.wjLoc); context.DispatchAjaxCommands(); } } } this.cleanup(); }
public override void webExecute( ) { if ( initialized == 0 ) { createObjects(); initialize(); } INITWEB( ) ; if ( ! isAjaxCallMode( ) ) { MasterPageObj = (GXMasterPage) ClassLoader.GetInstance("wwpbaseobjects.workwithplusmasterpage", "GeneXus.Programs.wwpbaseobjects.workwithplusmasterpage", new Object[] {new GxContext( context.handle, context.DataStores, context.HttpContext)}); MasterPageObj.setDataArea(this,false); ValidateSpaRequest(); MasterPageObj.webExecute(); if ( ( GxWebError == 0 ) && context.isAjaxRequest( ) ) { enableOutput(); if ( ! context.isAjaxRequest( ) ) { context.GX_webresponse.AppendHeader("Cache-Control", "no-store"); } if ( ! context.WillRedirect( ) ) { context.GX_webresponse.AddString((String)(context.getJSONResponse( ))); } else { if ( context.isAjaxRequest( ) ) { disableOutput(); } RenderHtmlHeaders( ) ; context.Redirect( context.wjLoc ); context.DispatchAjaxCommands(); } } } this.cleanup(); }
public bool IsAuthenticated(string synchronizer) { GXLogging.Debug(log, "IsMainAuthenticated synchronizer:" + synchronizer); bool validSynchronizer = false; try { if (!string.IsNullOrEmpty(synchronizer)) { string nspace; if (!Config.GetValueOf("AppMainNamespace", out nspace)) { nspace = "GeneXus.Programs"; } String assemblyName = synchronizer.ToLower(); String restServiceName = nspace + "." + assemblyName + "_services"; GxRestService synchronizerService = (GxRestService)ClassLoader.GetInstance(assemblyName, restServiceName, null); if (synchronizerService != null && synchronizerService.IsSynchronizer) { validSynchronizer = true; return(IsAuthenticated(synchronizerService.IntegratedSecurityLevel, synchronizerService.IntegratedSecurityEnabled, synchronizerService.ExecutePermissionPrefix)); } } return(false); } catch (Exception ex) { GXLogging.Error(log, ex, "IsMainAuthenticated error "); return(false); } finally { if (!validSynchronizer) { SetError("0", "Invalid Synchronizer " + synchronizer); } } }
public override void webExecute() { try { NameValueCollection parms = context.HttpContext.Request.GetQueryString(); string gxobj = parms["object"]; string attribute = parms["att"]; string json = null; GxStringCollection gxparms = new GxStringCollection(); if (parms.Count > 2) { for (int i = 2; i < parms.Count; i++) { gxparms.Add(parms[i]); } } if (!string.IsNullOrEmpty(gxobj) && !string.IsNullOrEmpty(attribute)) { string nspace; if (!Config.GetValueOf("AppMainNamespace", out nspace)) { nspace = "GeneXus.Programs"; } GXHttpHandler handler = (GXHttpHandler)ClassLoader.GetInstance(gxobj, nspace + "." + gxobj, null); handler.initialize(); json = (string)handler.GetType().InvokeMember("rest_" + attribute.ToUpper(), BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, handler, new object[] { gxparms }); handler.GetType().InvokeMember("cleanup", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, handler, null); } if (!string.IsNullOrEmpty(json)) { if (context.IsMultipartRequest) { this.context.HttpContext.Response.ContentType = MediaTypesNames.TextHtml; } else { this.context.HttpContext.Response.ContentType = MediaTypesNames.ApplicationJson; } #if NETCORE this.context.HttpContext.Response.Write(json); #else this.context.HttpContext.Response.Output.WriteLine(json); #endif } else { this.SendResponseStatus(404, "Resource not found"); } } catch (Exception ex) { SendResponseStatus(500, ex.Message); HttpHelper.SetResponseStatusAndJsonError(context.HttpContext, "500", ex.Message); } finally { try { context.CloseConnections(); } catch { } } }