// Copyright � 2007 Jeffrey Bazinet, http://www.vwd-cms.com/
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Specialized;
namespace VwdCms.Configuration
{
public class QueryRedirect
{
private string _key = string.Empty;
private string _query = string.Empty;
private string _newUrl = string.Empty;
public StringCollection QueryNames = new StringCollection();
public StringCollection QueryValues = new StringCollection();
public CmsConfig CmsConfig = null;
public PageRedirect PageRedirect = null;
public QueryRedirect(PageRedirect pageRedir, System.Xml.XmlNode node)
{
this.PageRedirect = pageRedir;
this.CmsConfig = pageRedir.CmsConfig;
this.Key = CmsConfig.GetChildNodeInnerText(node, "key", this.CmsConfig);
this.Query = CmsConfig.GetChildNodeInnerText(node, "query", this.CmsConfig);
this.NewUrl = CmsConfig.GetChildNodeInnerText(node, "newurl", this.CmsConfig);
if (!string.IsNullOrEmpty(this.Query))
{
string[] pairs = this.Query.Split(';');
if (pairs != null pairs.Length 0)
{
foreach (string pair in pairs)
{
string[] nameval = pair.Split('=');
if (nameval != null nameval.Length == 2)
{
this.QueryNames.Add(nameval[0]);
this.QueryValues.Add(nameval[1]);
}
}
}
}
}
public string Key
{
get { return _key; }
set
{
if (!string.IsNullOrEmpty(value))
{
_key = value.ToLower();
if (_key.StartsWith("/"))
{
_key = _key.Substring(1);
}
}
else
{
_key = string.Empty;
}
}
}
public string Query
{
get { return _query; }
set { _query = value; }
}
public string NewUrl
{
get { return _newUrl; }
set { _newUrl = value; }
}
}
}