Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Greetings,

 

The following may be imposible to do, but Iwould appreciate any help or comment .....

 

I have an ASP.Net application with heavy database workload, I am trying to load a user-control onto the requesting page thru an HttpModule onBeginRequest event, I am planning on disposing of the object onRequestEnd. The purpose of this is to present the user with a message "Please Wait .... Data Procesing" and an animated gif packaged into a control, while the request is being processed.

 

This is the code so far in the Module....

 

Public Sub thebegining(ByVal s As Object, ByVal e As EventArgs)

Dim mycontrol As splashcntl = New splashcntl()

Ctx.Current.Application.Add("splashcntl", mycontrol)

End Sub

 

I can't flush the response here because the session ID has not yet been written to the cookie, and I am not sure how to get this object to the requesting page pre-procesing.

 

If you know a way or if you know a different approach I would appreciate your direction.

Posted

While your are loading from DB, you can't "write" any html to the client. This is all server-side and your data you read from your sql or similar will be written into HTML like <div>Some text</div> or textboxes...

 

The only thing you can do:

befor datarequest open with javascript a window (with message...), reload the current page and close the window with the message when you have all data loaded and generated the new html-page.

Posted

Hello WebJumper,

 

I understand what you are saying, but it seems to me that there must be a way to send a response to the browser while or (prior to) processing the request. I am thinking that it must be in a asynchcronous manner.

 

I got the following code now but I get a message that the user control I am trying to load is not in the same application context as the request being process (I think)

 

Public Sub thebegining(ByVal s As Object, ByVal e As EventArgs)

Dim app As HttpApplication = CType(s, HttpApplication)

Dim mycontrol As UserControl = New UserControl()

mycontrol.LoadControl("splash.ascx")

app.Context.Current.Items.Add("Item1", mycontrol)

app.Context.Response.Write(mycontrol)

.

.

.

 

Again you are probably wrigth!

 

Anyways, If anyone can tell me why I am geting this error message...

 

[HttpException (0x80004005): The virtual path '/splash.ascx' maps to another application, which is not allowed.]

System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir, Boolean allowCrossAppMapping)

System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) +99

System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context)

System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context)

System.Web.UI.TemplateControl.LoadControl(String virtualPath)

APLoad.splashcntl.thebegining(Object s, EventArgs e) in C:\Inetpub\wwwroot\APLoad\Classes\splashcntl.vb:24

System.Web.SyncEventExecutionStep.Execute() +60

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87

 

 

Thanks!!

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...