System.Web.HttpServerUtility.Transfer C# (CSharp) Method

Transfer() public method

public Transfer ( IHttpHandler handler, bool preserveForm ) : void
handler IHttpHandler
preserveForm bool
return void
		public void Transfer (IHttpHandler handler, bool preserveForm)
		{
			if (handler == null)
				throw new ArgumentNullException ("handler");

			// TODO: see the MS doc and search for "enableViewStateMac": this method is not
			// allowed for pages when preserveForm is true and the page IsCallback property
			// is true.
			Execute (handler, null, preserveForm, context.Request.CurrentExecutionFilePath, null, true, true);
			context.Response.End ();
		}

Same methods

HttpServerUtility::Transfer ( string path ) : void
HttpServerUtility::Transfer ( string path, bool preserveForm ) : void

Usage Example

		/**
		 * Transfers control to the Error page using Server.Transfer, and displays some error information.
		 * 
		 * header: The error page header, ex. "Page not found". HTML in the string is not escaped.
		 * description: A description of the error, ex. "Path /foo/bar.txt not found". HTML in the string is not escaped.
		 * code: The response code of the page, ex. 404.
		 */
		public static void transferToError(HttpServerUtility server, HttpContext context, string header, string description, int code) {
			context.Items.Clear ();
			context.Items ["ErrorPage_title"] = header;
			context.Items ["ErrorPage_desc"] = description;
			context.Items ["ErrorPage_code"] = code;
			server.Transfer ("~/ErrorPage.aspx", false);
		}
All Usage Examples Of System.Web.HttpServerUtility::Transfer