Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Objects/Factory/Support
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv3960/src/Spring/Spring.Web/Objects/Factory/Support
Modified Files:
WebObjectUtils.cs
Log Message:
fixed SPRNET-838
Index: WebObjectUtils.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectUtils.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** WebObjectUtils.cs 3 Dec 2007 16:11:31 -0000 1.2
--- WebObjectUtils.cs 27 Jan 2008 23:29:55 -0000 1.3
***************
*** 182,189 ****
{
AssertUtils.ArgumentHasText(pageUrl, "pageUrl");
- if (s_log.IsDebugEnabled)
- {
- s_log.Debug("getting page type for " + pageUrl);
- }
HttpContext ctx = HttpContext.Current;
--- 182,185 ----
***************
*** 193,197 ****
}
! string rootedVPath = WebUtils.CombineVirtualPaths(ctx.Request.CurrentExecutionFilePath, pageUrl);
if (s_log.IsDebugEnabled)
{
--- 189,224 ----
}
! try
! {
! Type pageType = GetCompiledPageType(pageUrl);
! return pageType;
! }
! catch (Exception ex)
! {
! string msg = String.Format("Unable to get page type for url [{0}]", pageUrl);
! s_log.Error(msg, ex);
! throw new ObjectCreationException(msg, ex);
! }
! }
!
! /// <summary>
! /// Calls the underlying ASP.NET infrastructure to obtain the compiled page type
! /// relative to the current <see cref="HttpRequest.CurrentExecutionFilePath"/>.
! /// </summary>
! /// <param name="pageUrl">
! /// The filename of the ASPX page relative to the current <see cref="HttpRequest.CurrentExecutionFilePath"/>
! /// </param>
! /// <returns>
! /// The <see cref="System.Type"/> of the ASPX page
! /// referred to by the supplied <paramref name="pageUrl"/>.
! /// </returns>
! public static Type GetCompiledPageType(string pageUrl)
! {
! if (s_log.IsDebugEnabled)
! {
! s_log.Debug("getting page type for " + pageUrl);
! }
!
! string rootedVPath = WebUtils.CombineVirtualPaths(HttpContext.Current.Request.CurrentExecutionFilePath, pageUrl);
if (s_log.IsDebugEnabled)
{
***************
*** 200,217 ****
Type pageType = null;
- try
- {
#if NET_2_0
! pageType = BuildManager.GetCompiledType(rootedVPath); // requires rooted virtual path!
#else
! pageType = CreatePageInstance(pageUrl).GetType();
#endif
- }
- catch(Exception ex)
- {
- string msg = String.Format("Unable to get page type for url [{0}]", pageUrl);
- s_log.Error(msg, ex);
- throw new ArgumentException(msg, ex);
- }
if (s_log.IsDebugEnabled)
--- 227,235 ----
Type pageType = null;
#if NET_2_0
! pageType = BuildManager.GetCompiledType(rootedVPath); // requires rooted virtual path!
#else
! pageType = CreatePageInstance(pageUrl).GetType();
#endif
if (s_log.IsDebugEnabled)
***************
*** 222,225 ****
--- 240,244 ----
}
+
/// <summary>
/// Gets the controls type from a given filename
|