All pastes #246901 Raw Edit

Something

public text v1 · immutable
#246901 ·published 2006-11-12 20:46 UTC
rendered paste body
public void RewritePath (string path)
		{
#if NET_2_0
			RewritePath (path, true);
#else
			RewritePath (path, false);
#endif
		}

		public void RewritePath (string filePath, string pathInfo, string queryString)
		{
			RewritePath (filePath, pathInfo, queryString, false);
		}

#if NET_2_0
		public
#else
		internal
#endif
		void RewritePath (string path, bool rebaseClientPath)
		{
			int qmark = path.IndexOf ('?');
			if (qmark != -1)
				RewritePath (path.Substring (0, qmark), "", path.Substring (qmark + 1), rebaseClientPath);
			else
				RewritePath (path, null, null, rebaseClientPath);
		}

#if NET_2_0
		public
#else
		internal
#endif
		void RewritePath (string filePath, string pathInfo, string queryString, bool setClientFilePath)
		{
			filePath = UrlUtils.Combine (Request.BaseVirtualDir, filePath);
			if (!filePath.StartsWith (HttpRuntime.AppDomainAppVirtualPath))
				throw new HttpException (404, "The virtual path '" + filePath +
					"' maps to another application.");

			Request.SetCurrentExePath (filePath);
			// A null pathInfo or queryString is ignored and previous values remain untouched
			if (pathInfo != null)
				Request.SetPathInfo (pathInfo);

			if (queryString != null)
				Request.QueryStringRaw = queryString;
#if NET_2_0
			if (setClientFilePath)
				Request.SetFilePath (filePath);
#endif
		}