Click here to Skip to main content
12,503,679 members (29,852 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Samples » Downloads

Stats

39.8K views
208 downloads
22 bookmarked
Posted

BooProd.Core - Context sensitive URL

, 22 Dec 2004
Helps you create context sensitive dynamic URLs: dynamically computed URLs, depending on which server the page is generated on.
BooProd.Core.TestDynURL
BooProd.Core
bin
Release
BooProd.Core.csproj.user
ConfigFiles
Inetpub
wwwroot
BooProd.Core.TestDynURL
bin
BooProd.Core.dll
BooProd.Core.TestDynURL.dll
_vti_cnf
BooProd.Core.dll
BooProd.Core.TestDynURL.dll
BooProd.Core.TestDynURL.csproj.webinfo
Global.asax
using System;
using System.Xml;
using System.Xml.Schema;
using System.Collections;

namespace BooProd.Core
{

	/// <summary>
	/// v1.1	/ 2004-12-06 / CB => Enable empty ExeWebSite element.
	/// v1.0	/ 2004-11-15 / CB => Creation
	/// </summary>

	public class ExeWebSite
	{

		#region ACCESS
		/// <summary>
		/// Alias:
		/// WebSite Alias. Alias is a key value.
		/// </summary>
		private string _Alias;
		public string Alias {
			get { return _Alias; }
		}

		/// <summary>
		/// URL:
		/// URL depending of the execution context.
		/// </summary>
		public string URL {
			get { if (ExeContext.IsLocal) return _LocalURL; else return _ProdURL;}
		}

		/// <summary>
		/// LocalURL:
		/// URL on a local execution context.
		/// </summary>
		private string _LocalURL;
		public string LocalURL {
			get { return _LocalURL;}
		}
		/// <summary>
		/// ProdURL:
		/// URL on a production execution context.
		/// </summary>
		private string _ProdURL;
		public string ProdURL {
			get { return _ProdURL;}
		}
		#endregion

		#region CREATION

		/// <summary>
		/// Create a new instance from the XML node.
		/// </summary>
		/// <param name="reader"></param>
		/// <returns></returns>
		public static ExeWebSite newFromXML(XmlNodeReader reader) {
			// If wrong elem, or none, get out of here.
			if (reader.IsStartElement("ExeWebSite")==false)
				return null;
			if (reader.IsEmptyElement)
				return null;

			ExeWebSite vElem= new ExeWebSite();
			reader.ReadStartElement("ExeWebSite");
			vElem._Alias= reader.ReadElementString("alias");
			// Local
			reader.ReadStartElement("local");
			vElem._LocalURL= reader.ReadElementString("url");
			reader.ReadEndElement();
			// Prod
			reader.ReadStartElement("prod");
			vElem._ProdURL= reader.ReadElementString("url");
			reader.ReadEndElement();
			reader.ReadEndElement();
			return vElem;
		}
		/// <summary>
		/// 
		/// </summary>
		/// <param name="reader"></param>
		/// <returns></returns>
		public static Hashtable newAllFromXML(XmlNodeReader reader) {
			Hashtable		vHashtable= new Hashtable();
			ExeWebSite	vElem=			null;
			try {
				if (reader.IsStartElement("ExeWebSiteList")==false)
					return vHashtable;

				// WebSiteList
				reader.ReadStartElement("ExeWebSiteList");
				vElem= ExeWebSite.newFromXML(reader);
				while (vElem!=null) {
					vHashtable.Add(vElem.Alias, vElem);
					vElem= ExeWebSite.newFromXML(reader);
				}
				reader.ReadEndElement();
				// WebSiteList END
			} catch {
			}
			return vHashtable;
		}
		#endregion

		#region INIT

		/// <summary>
		/// Constructor
		/// </summary>
		public ExeWebSite() {}

		#endregion

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Boo!
Web Developer
France France
I work on a leading European telecom provider regarding on-line real time account management for B2B and B2C customers. Before this position, I worked in one of the leading European council providers of economic forecasts analyses.

I jump into software development in 1985 and never stop! I work with a lot of systems like Apple, NeXT, Unix, Windows. I develop with a lot of languages like Assembler, Pascal, C, C++, Java and C#. I play with databases like Oracle and SQL Server. I love networks and like to make systems working and cooperate themselves.

I'm very interested in MAS: Multi Agent System and really hope that computer will be human in the future. I work on BDI architecture extensions on this purpose, but this is the project of my life!

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 22 Dec 2004
Article Copyright 2004 by Boo!
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid