WebForms support for openrasta
openrasta / openrasta-codecs-webforms Goto Github PK
View Code? Open in Web Editor NEWWebForms support for openrasta
WebForms support for openrasta
Hi,
I'm having some trouble with views that have usercontrols on them, basically it seems the controls are getting rendered before the handler is executed so any data being passed via HttpContext.Current.Items for example doesn't always get seen by the view ... however subsequent requests do then work, but it's as if it's caching or maybe has managed to execute quicker.
I've tried quite a few different ways to workaround this now like using App/Session vars but it doesn't help. From looking at the source it seem's dependant on the order it's currently executed in so I've been trying to modify it to return a custom Page class with an extra event that is run once the handler is executed and thus giving a point later in the request for the control to bind too, but so far my event doesn't seem to be firing in time.
Are you able to shed any light on this or recommend proper use of controls on views?
Kind Regards
Jamie
If a page can not be created by the BuildManager, the handler is set up to return a 404.
The only way to discover why your page isn't working is to attach a debugger to the openrasta-codecs-webforms code.
I am using openwrap to get openrasta. According to openwrap my dependencies are up-to-date:
C:\Work\Rest\MyRestApplication>o update-wrap
# OpenWrap Shell 1.1.0.35
# Copyright © naughtyProd Limited 2009-2011
# Using C:\Work\Rest\MyRestApplication\wraps\_cache\openwrap-1.0.0.63365789\bin-net35\OpenWrap.dll (1.0.0.0)
Project repository: openwrap up-to-date.
Project repository: SharpZipLib up-to-date.
Project repository: openfilesystem up-to-date.
Project repository: tdnet-framework up-to-date.
Project repository: openrasta-full up-to-date.
Project repository: openrasta-core up-to-date.
Project repository: NUnit up-to-date.
Project repository: Moq up-to-date.
Project repository: openrasta-sharpview up-to-date.
Project repository: openrasta-aspnet up-to-date.
I am following the guide here - https://github.com/openrasta/openrasta-stable/wiki/Building-Your-First-OpenRasta-Website
When my HomeView.aspx file looks like this:
<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenRasta.Codecs.WebForms.ResourceView<Home>" %>
The sample works correctly. However, if I try to use the full type name instead of Home
, like this:
<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenRasta.Codecs.WebForms.ResourceView<MyRestApplication.Resources.Home>" %>
Then there is an exception:
System.ArgumentNullException occurred
Message=Value cannot be null.
Source=mscorlib
StackTrace:
at System.RuntimeType.MakeGenericType(Type[] instantiation)
InnerException:
The full stack trace is:
mscorlib.dll!System.RuntimeType.MakeGenericType(System.Type[] instantiation) + 0x203 bytes
OpenRasta.Codecs.WebForms.DLL!OpenRasta.Codecs.WebForms.OpenRastaPageParserFilter.TypeDef.BuildType() Line 274 + 0x24 bytes C#
OpenRasta.Codecs.WebForms.DLL!OpenRasta.Codecs.WebForms.OpenRastaPageParserFilter.TypeBuilder.Parse(string typeName) Line 245 + 0x1d bytes C#
OpenRasta.Codecs.WebForms.DLL!OpenRasta.Codecs.WebForms.OpenRastaPageParserFilter.GetTypeFromCSharpType(string typeName, System.Collections.Generic.IEnumerable<string> namespaces) Line 59 + 0x2f bytes C#
OpenRasta.Codecs.WebForms.DLL!OpenRasta.Codecs.WebForms.OpenRastaPageParserFilter.ParseInheritsAttribute(string originalAttribute) Line 106 + 0x47 bytes C#
OpenRasta.Codecs.WebForms.DLL!OpenRasta.Codecs.WebForms.OpenRastaPageParserFilter.PreprocessDirective(string directiveName, System.Collections.IDictionary attributes) Line 130 + 0x77 bytes C#
System.Web.dll!System.Web.UI.TemplateParser.PreprocessDirective(string directiveName, System.Collections.IDictionary directive) + 0x35 bytes
System.Web.dll!System.Web.UI.TemplateParser.ParseStringInternal(string text, System.Text.Encoding fileEncoding) + 0x3a6 bytes
System.Web.dll!System.Web.UI.TemplateParser.ParseString(string text, System.Web.VirtualPath virtualPath, System.Text.Encoding fileEncoding) + 0x6f bytes
System.Web.dll!System.Web.UI.TemplateParser.ParseFile(string physicalPath, System.Web.VirtualPath virtualPath) + 0x115 bytes
System.Web.dll!System.Web.UI.TemplateParser.ParseInternal() + 0x57 bytes
System.Web.dll!System.Web.UI.TemplateParser.Parse() + 0x64 bytes
System.Web.dll!System.Web.Compilation.BaseTemplateBuildProvider.CodeCompilerType.get() + 0x6f bytes
System.Web.dll!System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(System.Web.Compilation.BuildProvider buildProvider) + 0x42 bytes
System.Web.dll!System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(System.Collections.ICollection buildProviders) + 0xca bytes
System.Web.dll!System.Web.Compilation.WebDirectoryBatchCompiler.Process() + 0x5d bytes
System.Web.dll!System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(System.Web.Hosting.VirtualDirectory vdir, bool ignoreErrors) + 0x48 bytes
System.Web.dll!System.Web.Compilation.BuildManager.BatchCompileWebDirectory(System.Web.Hosting.VirtualDirectory vdir, System.Web.VirtualPath virtualDir, bool ignoreErrors) + 0xbc bytes
System.Web.dll!System.Web.Compilation.BuildManager.CompileWebFile(System.Web.VirtualPath virtualPath) + 0x5d bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x141 bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(System.Web.HttpContext context, System.Web.VirtualPath virtualPath, bool noBuild, bool allowCrossApp, bool allowBuildInPrecompile, bool throwIfNotFound, bool ensureIsUpToDate) + 0x70 bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(System.Web.VirtualPath virtualPath, System.Web.HttpContext context, bool allowCrossApp, bool throwIfNotFound) + 0x7e bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetCompiledType(System.Web.VirtualPath virtualPath) + 0xb bytes
System.Web.dll!System.Web.Compilation.BuildManager.GetCompiledType(string virtualPath) + 0x1d bytes
OpenRasta.Codecs.WebForms.DLL!OpenRasta.Codecs.WebForms.WebFormsCodec.WriteTo(object entity, OpenRasta.Web.IHttpEntity response, string[] codecParameters) Line 107 + 0x8 bytes C#
OpenRasta.DLL!OpenRasta.Pipeline.Contributors.ResponseEntityWriterContributor.WriteResponse(OpenRasta.Web.ICommunicationContext context) Line 75 C#
OpenRasta.DLL!OpenRasta.Pipeline.PipelineRunner.ExecuteContributor(OpenRasta.Web.ICommunicationContext context, OpenRasta.Pipeline.ContributorCall call) Line 192 + 0x1b bytes C#
OpenRasta.DLL!OpenRasta.Pipeline.PipelineRunner.RunCallGraph(OpenRasta.Web.ICommunicationContext context, OpenRasta.Pipeline.PipelineStage stage) Line 106 + 0x17 bytes C#
OpenRasta.DLL!OpenRasta.Pipeline.PipelineRunner.Run(OpenRasta.Web.ICommunicationContext context) Line 97 C#
OpenRasta.DLL!OpenRasta.Hosting.HostManager.HandleHostIncomingRequestReceived.AnonymousMethod__3() Line 196 + 0x2a bytes C#
OpenRasta.DLL!OpenRasta.Hosting.HostManager.ThreadScopedAction(System.Action action) Line 162 + 0xb bytes C#
OpenRasta.DLL!OpenRasta.Hosting.HostManager.HandleHostIncomingRequestReceived(object sender, OpenRasta.Hosting.IncomingRequestEventArgs e) Line 198 C#
OpenRasta.DLL!OpenRasta.EventHandlerExtensions.Raise<OpenRasta.Hosting.IncomingRequestReceivedEventArgs>(System.EventHandler<OpenRasta.Hosting.IncomingRequestReceivedEventArgs> handler, object src, OpenRasta.Hosting.IncomingRequestReceivedEventArgs args) Line 24 C#
OpenRasta.Hosting.AspNet.DLL!OpenRasta.Hosting.AspNet.AspNetHost.RaiseIncomingRequestReceived(OpenRasta.Web.ICommunicationContext context) Line 105 + 0x36 bytes C#
OpenRasta.Hosting.AspNet.DLL!OpenRasta.Hosting.AspNet.OpenRastaIntegratedHandler.ProcessRequest(System.Web.HttpContext context) Line 86 + 0x1d bytes C#
OpenRasta.Hosting.AspNet.DLL!OpenRasta.Hosting.AspNet.OpenRastaRewriterHandler.ProcessRequest(System.Web.HttpContext context) Line 64 + 0x2d bytes C#
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 0x65 bytes
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously) + 0x4c bytes
System.Web.dll!System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(System.Exception error) + 0x13e bytes
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback cb, object extraData) + 0xad bytes
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr) + 0x1a2 bytes
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr) + 0x7d bytes
System.Web.dll!System.Web.HttpRuntime.ProcessRequest(System.Web.HttpWorkerRequest wr) + 0x47 bytes
WebDev.WebHost40.dll!Microsoft.VisualStudio.WebHost.Request.Process() + 0x17b bytes
WebDev.WebHost40.dll!Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Microsoft.VisualStudio.WebHost.Connection conn) + 0x6c bytes
[Appdomain Transition]
WebDev.WebHost40.dll!Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(object acceptedSocket) + 0x83 bytes
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state) + 0x2d bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() + 0x5a bytes
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() + 0x147 bytes
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() + 0x2d bytes
[Native to Managed Transition]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.