Skip Navigation Links.

Northwind\WebControls\HttpHandlerBase.cs

D:\NorthwindForWeb\Northwind\CS\DotNet\ADO.Net\Northwind\WebControls\HttpHandlerBase.cs
/*
 * This file was generated by ProCG version 2.0
 *
 * File name:	Northwind\WebControls\HttpHandlerBase.cs
 * Language:	C# - ADO.Net 
 * Database:	My Sql
 *
 * Copyright (c) 2002-2019 iGenXSoft.
 * For more information visit http://www.igenxsoft.com
 */


using System;
using System.Web;
using System.Web.SessionState;
using System.Data;
using System.Runtime.InteropServices;
using System.Text;
using Northwind.General;
using Northwind.Data;

namespace Northwind.WebControls
{

	public class HttpHandlerBase : IHttpModule
	{
		protected string primaryKey;
		protected string id;
		protected HttpContext context;


		public virtual CNorthwindUser User
		{
			get
			{
				return SessionManager.User;
			}
		}



		#region IHttpModule Members

		public void Dispose()
		{			
		}

		public void Init(HttpApplication context)
		{
			context.BeginRequest += new EventHandler(context_BeginRequest);
			//context.EndRequest += new EventHandler(context_EndRequest);
		}

		void context_BeginRequest(object sender, EventArgs e)
		{
			HttpApplication httpApplication = (HttpApplication)sender;
			string absoluteUri = httpApplication.Request.Url.AbsoluteUri;
			if (absoluteUri.IndexOf("ScriptResource.axd") > 0)
				return;
			if (absoluteUri.IndexOf("%3E") > 0 || absoluteUri.IndexOf("%3C") > 0)
				RedirectErrorPage(httpApplication);

			if (absoluteUri.IndexOf(">") > 0 || absoluteUri.IndexOf("<") > 0)
				RedirectErrorPage(httpApplication);

			if (!Northwind.General.RegExs.ValidUrl(absoluteUri))
			{
				RedirectErrorPage(httpApplication);
			}
		}

		void RedirectErrorPage(HttpApplication httpApplication)
		{
			httpApplication.Response.Redirect(NorthwindGeneral.GetWebServerRootURL() + "Pages/DefaultErrorPage.aspx", true);
		}
		void context_EndRequest(object sender, EventArgs e)
		{
			HttpApplication httpApplication = (HttpApplication)sender;

			//^(?:http|https|ftp)://[a-zA-Z0-9\.\-]+(?:\:\d{1,5})?(?:[A-Za-z0-9\.\;\:\@\&\=\+\$\,\?/]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2})*$

			//httpApplication.Response.Write("<h4>Request Ends Here...</h4>");
		}


		#endregion
	}	
}




  //      2229 ProCG uses this line - don't edit it