internal static string GetHref(string nextState, NavigationData navigationData, NavigationData returnData)
		{
			string previousState = StateContext.StateId;
			string crumbTrail = StateContext.CrumbTrailKey;
			State state = StateContext.GetState(nextState);
			NameValueCollection coll = new NameValueCollection();
			coll[NavigationSettings.Config.StateIdKey] = nextState;
			if (previousState != null && state.TrackCrumbTrail)
			{
				coll[NavigationSettings.Config.PreviousStateIdKey] = previousState;
			}
			if (navigationData != null)
			{
				foreach (NavigationDataItem item in navigationData)
				{
					if (!item.Value.Equals(string.Empty) && !state.DefaultOrDerived(item.Key, item.Value))
						coll[item.Key] = FormatURLObject(item.Key, item.Value, state);
				}
			}
			if (returnData != null && state.TrackCrumbTrail && StateContext.State != null)
			{
				var returnDataBuilder = FormatReturnData(null, StateContext.State, returnData);
				if (returnDataBuilder.Length > 0)
					coll[NavigationSettings.Config.ReturnDataKey] = returnDataBuilder.ToString();
			}
			if (crumbTrail != null && state.TrackCrumbTrail)
			{
				coll[NavigationSettings.Config.CrumbTrailKey] = crumbTrail;
			}
#if NET35Plus
			coll = StateContext.ShieldEncode(coll, false, state);
#else
			coll = StateContext.ShieldEncode(coll, state);
#endif
#if NET40Plus
			HttpContextBase context = null;
			if (HttpContext.Current != null)
				context = new HttpContextWrapper(HttpContext.Current);
			else
				context = new MockNavigationContext(null, state);
			return state.StateHandler.GetNavigationLink(state, coll, context);
#else
			return state.StateHandler.GetNavigationLink(state, coll);
#endif
		}
		/// <summary>
		/// Redirects or Transfers to the <paramref name="url"/> depending on the 
		/// <paramref name="mode"/> specified
		/// </summary>
		/// <param name="state">The <see cref="State"/> to navigate to</param>
		/// <param name="url">The target location</param>
		/// <param name="mode">Indicates whether to Redirect or Transfer</param>
		/// <exception cref="System.ArgumentNullException"><paramref name="state"/> is null</exception>
		public static void NavigateLink(State state, string url, NavigationMode mode)
		{
			if (state == null)
				throw new ArgumentNullException("state");
#if NET40Plus
			HttpContextBase context = null;
			if (HttpContext.Current != null && mode != NavigationMode.Mock)
				context = new HttpContextWrapper(HttpContext.Current);
			else
				context = new MockNavigationContext(url, state);
			state.StateHandler.NavigateLink(state, url, mode, context);
#else
			state.StateHandler.NavigateLink(state, url, mode);
#endif
		}