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.IO;
///
/// URLRerite 的摘要说明
///
public class URLRerite : IHttpHandlerFactory
{
#region IHttpHandlerFactory 成员
public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
string path = url;
string extend = Path.GetExtension(path);
string getFileName = Path.GetFileNameWithoutExtension(path);
string sendpath = path.Replace(extend, ".aspx");
string filepath = pathTranslated;
string qurstring = "";
if (context.Request.QueryString.Count > 0)
{
qurstring = context.Request.QueryString.ToString() ;
}
// 重写URL
filepath = context.Server.MapPath(sendpath);
context.RewritePath(sendpath, String.Empty, qurstring);
return PageParser.GetCompiledPageInstance(sendpath, filepath, context);
}
public void ReleaseHandler(IHttpHandler handler)
{
//throw new Exception("The method or operation is not implemented.");
}
#endregion
}