public static void DebugPage(System.Web.UI.Page page)
{
if ( page == null )
return ;
//configure the logger of your choice
log4net.Config.DOMConfigurator.Configure(); //tis configures the logger
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append ("Now I should get the www.myhost.com:80/baseDir - baseDir , but I get " ;baseDir );
sb.Append ("The basedir of the project locally is is" + " HttpContext.Current.Server.MapPath(\"~/\"");
sb.AppendLine (System.Web.HttpContext.Current.Server.MapPath ( "~" ) );
sb.Append ("The basedir of the project locally is " ) ;
sb.Append ( "AppDomain.CurrentDomain.BaseDirectory;" ) ;
sb.AppendLine ( AppDomain.CurrentDomain.BaseDirectory );
sb.Append ("The virtual path of this page ( System.Web.HttpContext.Current.Request.PathInfo) is ")
sb.AppendLine ( System.Web.HttpContext.Current.Request.PathInfo );
sb.Append ("System.IO.Path.GetFileName ( System.Web.HttpContext.Current.Request.Url.AbsolutePath ");
sb.AppendLine (System.IO.Path.GetFileName ( System.Web.HttpContext.Current.Request.Url.AbsolutePath )) ;
sb.Append ("System.Web.HttpContext.Current.Request.Url.AbsolutePath -- " ) ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.AbsolutePath ) ;
sb.Append ("System.Web.HttpContext.Current.Request.Url.AbsoluteUri -- " ) ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.AbsoluteUri );
sb.Append ("System.Web.HttpContext.Current.Request.Url.DnsSafeHost -- " );
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.DnsSafeHost );
sb.Append ("System.Web.HttpContext.Current.Request.Url.Fragment -- " );
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.Fragment );
sb.Append ("System.Web.HttpContext.Current.Request.Url.Host -- ");
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.Host );
sb.Append ("System.Web.HttpContext.Current.Request.Url.HostNameType -- " ) ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.HostNameType.ToString() );
sb.Append ("System.Web.HttpContext.Current.Request.Url.LocalPath -- " ) ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.LocalPath );
sb.Append ("System.Web.HttpContext.Current.Request.Url.OriginalString -- " );
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.OriginalString );
sb.Append ("System.Web.HttpContext.Current.Request.Url.PathAndQuery -- " );
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.PathAndQuery );
sb.Append ("System.Web.HttpContext.Current.Request.Url.Scheme -- ") ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.Scheme );
sb.Append ("System.Web.HttpContext.Current.Request.Url.Segments.ToString () -- ") ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.Segments.ToString () );
sb.Append ("System.Web.HttpContext.Current.Request.Url.UserInfo -- ") ;
sb.AppendLine (System.Web.HttpContext.Current.Request.Url.UserInfo );
sb.Append ("System.Web.HttpContext.Current.Request.ServerVariables[ \"HTTP_COOKIE\" ] is ") ;
sb.AppendLine (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_COOKIE"] );
//echo the end to the logger of your choice
logger.Debug( sb.ToString());
}
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!