postprocessor.cs

来自「一个基于 Internet Explorer 中 MSHTML 技术的 ASP.」· CS 代码 · 共 38 行

CS
38
字号
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using FreeTextBoxControls;


namespace FreeTextBoxControls.Common
{
	/// <summary>
	/// Handles HTML processing 
	/// </summary>
	public class PostProcessor
	{
		/// <summary>
		/// Removes the local servername from A and IMG tags
		/// </summary>
		public string RemoveServerNameFromUrls(string input, string servername)
		{
			System.Web.HttpContext.Current.Trace.Write("ServerName",servername);
			input = Regex.Replace(input,"HREF=http://" + servername,"HREF=",RegexOptions.IgnoreCase);
			input = Regex.Replace(input,"HREF=\"http://" + servername,"HREF=\"",RegexOptions.IgnoreCase);
			input = Regex.Replace(input,"src=http://" + servername,"src=",RegexOptions.IgnoreCase);
			input = Regex.Replace(input,"src=\"http://" + servername,"src=\"",RegexOptions.IgnoreCase);
			return input;
		}
		/// <summary>
		/// Removes the scriptname from bookmarks (#mark).
		/// </summary>
		public string RemoveScriptNameFromBookmarks(string input, string serverName, string url, string qString)
		{
			System.Web.HttpContext.Current.Trace.Write("Bookmark",serverName + url + "?" + qString);
			input = input.Replace("href=\"http://" + serverName + url + "?" + qString,"href=\"");
			input = input.Replace("href=http://" + serverName + url + "?" + qString,"href=");
			return input;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?