MVC :: Response Waits For BackgroundWorker?

Jul 24, 2010

I have modified the sample HomeController to illustrate I problem that I have in my real application. In my real application I want a user to not wait for a longer running background process. I found that the response is not being returned to the user until the background process has finished which defeats the purpose of having a background task. Here is my modified sample MVC 2 application to illustrate.

[Code]....

When I click on About from the home page it takes ~20 seconds for the About page to appear. If I remove the Sleep(20000) from the background task then the page appears instantly. I expect a BackgroundWorker task to run in the background! What am I doing wrong?

View 3 Replies


Similar Messages:

Is It Possible To Configure Things So That IE7 Waits (much) Longer Before Giving Up

May 28, 2010

My issue is similar to ASP.NET Debugging Timing out with IIS except that I'm using the built-in ASP.Net Development Server with VS 2010.If I pause for more than about 10 seconds in the debugger, IE7 "disconnects" from the web server with the error message Internet Explorer cannot display the webpageHowever, unlike in the similar question, the debugger is still running. If I refresh the browser it will post that refresh to the server and I can debug the page from the top again.

Is it possible to configure things so that IE7 waits (much) longer before giving up?If it makes a difference, I'm launching IE using the "Start external program" option and passing a localhost URL as the command line argument (since Chrome is my default browser). I also specify a specific port.

View 1 Replies

Getting HttpContext From BackgroundWorker Process?

Aug 19, 2010

I have an ASP.NET site and I've been doing some work refactoring code to try to remove some long running processes (in the order of an hour) from the actual http Request by creating a BackgroundWorker and sending the work off to that to process. This was running fine on cutdown tests but when I applied the logic to the real code I found problems accessing Session variables from the code running in the Background Worker. It seems that the HttpContext object that was passed has a null session and if I ask for HttpContext.Current I get null back.

I'm assuming that this is because they are in a different thread and that the session and HttpContext.Current are both reliant on being in the same thread. Is there any way I can get access to the Session from the background worker or am I stuck with finding all the variables I need from session and putting them in an usable data structure and then putting them back in session (if appropriate) afterwards? It obviously complicates the refactor massively if I need to do this so I'd rather not.how I might do this other than BackgroundWorker processes

View 1 Replies

C# - Page Not Rendering Until BackgroundWorker.RunWorkerAsync Completes?

Jun 8, 2010

I have an aspx page that on a button click creates a BackgroundWorker and then calls the RunWorkerAsync method. In my aspx file I have set Async='true' but when I run the application and click the button it appears as though the page waits to refresh until the processing of the BackgroundWorker is done. How do I get control to return to the page (and have the page refresh) after the BackgroundWorker is created and started?

BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += RunJob;
worker.RunWorkerCompleted += JobCompleted;
worker.RunWorkerAsync();

View 1 Replies

Web Forms :: Backgroundworker Dont Display Data In .net With C#

Jun 15, 2010

I want to retrieve values from a function at regular intervals and display it.I have two different fucntions 1 for getting values and 1 for display.I am using backgroundworker for that.

So when i put continous loop it goes into infinite loop without displaying data.The problem is with asp.net ..

What have i done is

public void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs
e)

{
if (this.backgroundWorker1 == [code]...

Now until it doesnot come out of DoWork method if doenot display data eventhought it called Display_data() method.

I removed whilke(1=1) and checked that after exiting DoWork method it displays data.

So is there any way that after data binding in Display_Data() method i can display data and then refresh the whole process at backend ?

View 2 Replies

WCF / ASMX :: WCF With File Access When Running Function In BackgroundWorker

Mar 22, 2011

I have WCF method that opens and reads text file when I call it from WPF client, I do pass security credentials and it works fine, but when I try to put this method inside of BackgroundWorker I get Access to the path.

View 1 Replies

Web Forms :: Difference Between Response.Expire And Response.ExpiresAbsolute?

Mar 3, 2010

I am not able tto understand the differnce between REspose.Expire and Response.ExpiresAbsolute?

Is it mandatory to use both toghter?

View 4 Replies

Response Object / Response.AddHeader Is Used To Add A New HTML Header?

Jul 16, 2010

[Code]....

I am using this code to download and its working well for me.But i cant understand the code.Can someone explain me this code to me please?

Response.AddHeader is used to add a new HTML header,but what is an HTML header all about?and the parameters i am passing within it as the name and value;what are they?

View 3 Replies

Web Forms :: Response.Flush() | Response.Buffer = False: Neither Do Anything?

Sep 20, 2010

So,I have this code:

[Code]...

Even though I have buffer set to false,no text is displayed.I have tried adding a response.flush,with and without changing the buffer value.What exactly is wrong?I've also tried it with and without the label(i.e. with or without just Response.Write)

View 2 Replies

MVC :: Response.End And Filters / Can Get Response.End() To Work When Called

Nov 19, 2010

I have a static method that I use to control REST styled HTTP codes when my mvc application encounters an exception.

The method looks like:

[Code]....

This is static becuase then I can call it within an action or inside a filter. The problem I am having is that when I call RaiseException inside a filter, it stills goes into the requested action. Response.End() doesn't seem to have any effect. Any clues on how I can get Response.End() to work when called?

View 19 Replies

Necessary To Call Response.End() After Response.Redirect(url)?

Jan 13, 2011

Is it necessary to call Response.End() after Response.Redirect(url) Update for all the answers. Because some answers say that it's necessary and others say no, I have searched more and have found in msdn under remarks the following: Redirect calls End which raises a ThreadAbortException exception upon completion.

View 5 Replies

C# - Using Response.Filter With Response.TransmitFile?

Aug 10, 2010

I'm using Response.Filter in order to implement stream compression in accordance with HTTP Request Header Accept-Encoding

Here's the important stuff:

if (AcceptEncoding.Contains("deflate") || AcceptEncoding == "*")
{
HttpApp.Response.Filter = new DeflateStream(PreviousOutputStream, CompressionMode.Compress);
HttpApp.Response.AppendHeader("Content-Encoding", "deflate");
}


By and large this works as intended. However, I'm in a situation where I'm using an ActionResult on an MVC Controller to serve up files to the user agent:

Response.Clear();
Response.Headers["Content-Type"] = contentType;
Response.Headers["Content-Length"] = contentLength;
if (Request.QueryString["dl"] == "1")
{
Response.Headers["Content-Disposition"] = "attachment; filename=" + fileInfo.Name;
}
Response.Flush();
Response.TransmitFile(fileInfo.FullName);

To be more exact, the action method returns new EmptyResult() after the Response.TransmitFile() call. This works exactly as intended without the Response.Filter modification.

In this situation, the response entity reaches the user agent garbled and unintelligible. FireFox's Poster addon shows empty entities or jumbled entities coming back.

View 2 Replies

HttpHandlers / Modules :: Context.Response.Output Vs Context.Response.Write()?

Jan 24, 2010

I have written simple HttpModule. context.Response.Output.Write is working fine. but not context.Response.Write().

View 2 Replies

Response.TransmitFile "Response.End" To Download File

Mar 31, 2010

I have following function which is called from a button click event

[Code]....

I am creating a zip file on the fly and wanted to download this file.Problem is that in Internet explorer when I click the button the download accelrator comes with file name as my page saying resume opendialogueif i click open then DAP window close and normal windows download manager comes but the event of my button fires multiple time?I don't know what to do with it

View 6 Replies

Use Of Response.Flush Before Response.End

May 12, 2010

When to use Response.Flush? Do I need to call it every time before I call Response.End?

View 2 Replies

What's Difference Between Response.write And Response.output.write

Apr 22, 2010

what is difference between Response.write and Response.output.write

View 2 Replies

C# - Exactly Does Response.Redirect("~/...") Put In The HTTP Response?

Nov 24, 2010

I've just finished reading URL vs. URI vs. URN, in More Concise Terms, and it's really helped understand the distinction between the three terms. Since then I've skimmed the RFC2141 and RFC2616 specs and Microsoft's Response.Redirect Method documentation in an effort to answer the following question confidently.

Given this line of code:

Response.Redirect("~/Foo.aspx");

And this resulting HTTP response (trimmed for context):

Status=Found - 302 Date=Wed, 24 Nov
2010 17:27:58 GMT
Server=Microsoft-IIS/6.0
X-Powered-By=ASP.NET
X-AspNet-Version=2.0.50727
Location=/MyWebApp/Foo.aspx

What name(s) most properly describes what has been placed into the "Location" header?

URL? URI? URN? URC? Which is it?

View 5 Replies

Response .ascx From .dll

Mar 25, 2011

I wanna response the ascx file from my .dll

View 2 Replies

C# - Enumerate The Response Set From FQL?

Aug 3, 2010

var response = _facebookAPI.Fql.Query(String.Format("SELECT uid FROM event_member WHERE eid={0}", myevent));
I would like to convert response to List<long> uids

View 1 Replies

Processing Something After Response.End?

Mar 30, 2010

When user click a button the system query from DB, made the zip file and it will be downloaded.

Problem is that after the download i wanted to delete the file from the server.

But After Response.End() no further processing done and cursor is not coming to next line of code where this File.Delete line is calle.

View 9 Replies

C# - How To Get A Redirection Response

Oct 1, 2010

How to get the response (which is a redirect instruction) of a request from server side? For example if I put www.abc.com in the browser the browser automatically gets redirected to www.xyz.com. Now I need to get that redirect url from server side. i.e. need send a request to www.abc.com in response it returns a redirect url www.xyz.com, need to store this xyz.com.

View 1 Replies

C# - Can I Zip Response.write

Jan 21, 2010

Let me explain better than what the question state. I dynamically generate a KML file from an aspx page and use routing to change the url so I can access myapp.com/mykml.kml and the download starts. I use Response.write() in the aspx page to send the data and it work flawlessly. But there is a zipped version for KML files which is KMZ and I am wondering if I can still use my aspx page to serve a KMZ instead of a KML. Since I do not use a file I cannot "zip" it. Is there a way to zip the stream and output it in the Response.Write()?

View 1 Replies

Use Of Response.Redirect In C#

Feb 16, 2010

I am working on a website that I inherited (ASP.NET and C#), and I noticed that in almost EVERY method in the code behind of the project pages (except some helper methods), the original author uses Response.Redirect() to redirect to a page (typically home.aspx, but not always).

What is the purpose of doing this? It seems unneeded to me - at least it doesn't appear to change anything the website is doing if I keep it in or remove it.

View 5 Replies

C# - Get Only Response Headers?

Oct 31, 2010

Using ASP.NET is it possible to make a request and get only response headers? I have to do a request to a big file, but I only need the response headers, i dont care about the content of the file.

I would like to know if there is something similar to get_headers from php (http://php.net/manual/en/function.get-headers.php).

View 2 Replies

SOAP Webservice XML Response

Jan 22, 2010

I have a SOAP webservice. One method has a return type of XmlDocument. I then sent this service to guys that need to consume it. And this is there response: I see the web service returns and xml string. Why not just wrap the results in the web service response itself? what he means by that? I have asked, but I have received no reply from him yet. That I can make it return proper XML and not XML formatted string?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved