Ejemplo n.º 1
0
        /// <summary> Gets the URL to be used for transfering to the external function. </summary>
        internal string GetDestinationUrlForExternalFunction(WxeFunction function, string functionToken, WxePermaUrlOptions permaUrlOptions)
        {
            string href;

            if (permaUrlOptions.UsePermaUrl)
            {
                NameValueCollection internalUrlParameters;
                if (permaUrlOptions.UrlParameters == null)
                {
                    internalUrlParameters = function.VariablesContainer.SerializeParametersForQueryString();
                }
                else
                {
                    internalUrlParameters = permaUrlOptions.UrlParameters.Clone();
                }
                internalUrlParameters.Set(WxeHandler.Parameters.WxeFunctionToken, functionToken);

                href = GetPermanentUrl(function.GetType(), internalUrlParameters, permaUrlOptions.UseParentPermaUrl);
            }
            else
            {
                UrlMappingEntry mappingEntry = UrlMappingConfiguration.Current.Mappings[function.GetType()];
                string          path         = (mappingEntry != null) ? mappingEntry.Resource : _httpContext.Request.Url.AbsolutePath;
                href = GetPath(path, functionToken, permaUrlOptions.UrlParameters);
            }

            return(href);
        }
Ejemplo n.º 2
0
        /// <summary>  Invokes <see cref="WxeFunction.Execute(WxeContext)"/> on the <paramref name="function"/>. </summary>
        /// <include file='..\doc\include\ExecutionEngine\WxeHandler.xml' path='WxeHandler/ExecuteFunction/*' />
        protected virtual void ExecuteFunction(WxeFunction function, WxeContext context, bool isNew)
        {
            ArgumentUtility.CheckNotNull("function", function);
            ArgumentUtility.CheckNotNull("context", context);
            if (function.IsAborted)
            {
                throw new ArgumentException("The function " + function.GetType().FullName + " is aborted.");
            }

            function.ExceptionHandler.AppendCatchExceptionTypes(typeof(WxeUserCancelException));
            function.Execute(context);
        }
Ejemplo n.º 3
0
        private static string GetExternalFunctionUrl(WxeFunction function, bool createPermaUrl, NameValueCollection urlParameters)
        {
            string functionToken = WxeContext.Current.GetFunctionTokenForExternalFunction(function, false);

            NameValueCollection internalUrlParameters;

            if (urlParameters == null)
            {
                if (createPermaUrl)
                {
                    internalUrlParameters = function.VariablesContainer.SerializeParametersForQueryString();
                }
                else
                {
                    internalUrlParameters = new NameValueCollection();
                }
            }
            else
            {
                internalUrlParameters = NameValueCollectionUtility.Clone(urlParameters);
            }
            internalUrlParameters.Set(WxeHandler.Parameters.WxeFunctionToken, functionToken);
            return(WxeContext.GetPermanentUrl(WxeContext.Current.HttpContext, function.GetType(), internalUrlParameters));
        }