Example #1
0
        public string Save()
        {
            String url = Request.QueryString["pid"];
            CmsPage page = PageManager.Instance.GetLatestPage(url);

            PreviewDto dto = new PreviewDto();
            dto.Content = PageMarkupText.Text;
            dto.Title = page.Title;
            dto.TemplateName = this.PageTemplate.SelectedValue;

            QueueManager manager = new QueueManager(QueueManager.GetPreviewQueueName(CurrentSite.Guid));
            manager.ClearQueue();
            manager.Put<PreviewDto>(dto);

            String cacheKey = TextHash.MD5(Request.QueryString["pid"]).Value;

            String token = Server.UrlEncode(TokenManager.Issue(cacheKey, TimeSpan.FromMinutes(5)));
            return Page.ResolveUrl(CurrentSite.Protocol + CurrentSite.StagingDomain + url + "?pvw=preview&pvw_id=" + cacheKey + "&token=" + token);
        }
		internal void Dispose() {
			WaitForRequests (2000);
			queueManager.Dispose (); // Send a 503 to all queued requests
			queueManager = null;
			_cache = null;
			HttpApplicationFactory.EndApplication();
		}
		private void OnFirstRequestStart(HttpContext context) {
			if (_initError != null)
				throw _initError;

			try {
				WebConfigurationSettings.Init (context);
				traceManager = new TraceManager ();
				queueManager = new QueueManager ();
			} catch (Exception e) {
				_initError = e;
			}

			// If we got an error during init, throw to client now..
			if (null != _initError)
				throw _initError;
		}
Example #4
0
		static HttpRuntime ()
		{
			firstRun = true;

			try {
				WebConfigurationManager.Init ();
				SettingsMappingManager.Init ();
				runtime_section = (HttpRuntimeSection) WebConfigurationManager.GetSection ("system.web/httpRuntime");
			} catch (Exception ex) {
				initialException = ex;
			}

			// The classes in whose constructors exceptions may be thrown, should be handled the same way QueueManager
			// and TraceManager are below. The constructors themselves MUST NOT throw any exceptions - we MUST be sure
			// the objects are created here. The exceptions will be dealt with below, in RealProcessRequest.
			queue_manager = new QueueManager ();
			if (queue_manager.HasException) {
				if (initialException == null)
					initialException = queue_manager.InitialException;
				else {
					Console.Error.WriteLine ("Exception during QueueManager initialization:");
					Console.Error.WriteLine (queue_manager.InitialException);
				}
			}

			trace_manager = new TraceManager ();
			if (trace_manager.HasException) {
				if (initialException == null)
					initialException = trace_manager.InitialException;
				else {
					Console.Error.WriteLine ("Exception during TraceManager initialization:");
					Console.Error.WriteLine (trace_manager.InitialException);
				}
			}

			registeredAssemblies = new SplitOrderedList <string, string> (StringComparer.Ordinal);
			cache = new Cache ();
			internalCache = new Cache ();
			internalCache.DependencyCache = internalCache;
			do_RealProcessRequest = new WaitCallback (state => {
				try {
					RealProcessRequest (state);
				} catch {}
				});
			end_of_send_cb = new HttpWorkerRequest.EndOfSendNotification (EndOfSend);
		}