.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links


Posted By:      Posted Date: October 16, 2010    Points: 0   Category :ASP.Net


I am trying to incorporate Response.Flush() into an application.  The following code (without any server controls) runs sucessfully i.e. 0 appears on page, then one second passes, then 1 appears on the page, then one second passes, then 2 appears on the page.

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim d As Integer
        For d = 0 To 2
            Response.Buffer = True
            Response.BufferOutput = True
    End Sub

However, when I incorporate a server control into the code it fails e.g. if I build a table dynamically on each loop and add it to a Placeholder as follows:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim d As Integer

View Complete Post

More Related Resource Links

Response.BinaryWrite help needed


Hi all

Im new to .NET and stuck now, so i hope anyone can help my with my problem.

I have a MS SQL database where i have stored some documents as Binary data. I cant figure out how to retrieve them and show/download them in my browser.

I found some guides online and have try to put something together.


private void Write()
 int id = 0;
 string strID = Request.QueryString["id"];
 int.TryParse(strID, out id);

 var db = new ModelDataContext();
 var doc = db.DocumentDatas.Where(x => x.ID == id).FirstOrDefault();

 byte[] byteArray = File.ReadAllBytes(doc);


How do i fill the byteArray with the data?

Thanks in advance :)


Response.Redirect slow


I'm in the middle of migrating servers and on the new server Response.Redirect is extremely slow. It takes around 20 seconds for the browser to get the redirect. This is something that was quick on the existing server. It's an ASP.NET 2.0 application, both servers are running IIS6.

Additionally, if I "manually" do the redirect, it's fast. For example:

Existing way:


takes around 20 seconds on the new server

New way:

Response.Status = "302 Moved Temporarily";
Response.AddHeader("Location", url);

is fast on the new server.

Any ideas why Response.Redirect would be so slow on the new server?

Test Run: Web Application HTTP Request-Response Test Automation with JavaScript


Write a simple browser-based request-response test automation using JavaScript that's platform independent and useful when you are working in a highly dynamic environment.

James McCaffrey

MSDN Magazine January 2010

Test Run: Request-Response Testing With F#


This month we show you how to use F# to perform HTTP request-response testing for ASP.NET Web applications.

James McCaffrey

MSDN Magazine July 2009

Test Run: Request/Response Testing with Windows PowerShell


Did you know you can use Windows PowerShell to perform lightweight request/response testing for an ASP.NET Web app? Here's how.

Dr. James McCaffrey

MSDN Magazine May 2008

Talk Back: Voice Response Workflows with Speech Server 2007


Speech Server 2007 lets you create sophisticated voice-response applications with Microsoft .NET Framework and Visual Studio tool integration. Here's how.

Michael Dunn

MSDN Magazine April 2008

Foundations: Build a Queued WCF Response Service


With queued calls in Windows Communication Foundation you can perform work in a disconnected manner by sending messages through Microsoft Message Queuing. Juval Lowy explains.

Juval Lowy

MSDN Magazine February 2007



I need to open a new window with Response.Redirect, Is it possible?

no response when refreshing reportviewer


Hi guys, I've been struggling with this for some time now, but I can't figure out why it's not working. I got a gridview in which I'm selecting a specific row. This gives me a string back, which is used to load some data inside a datatable, using DAL The callback works and it's also giving the correct string to retrieve the wanted data. But when I'm trying to use this fresh data update my reportviewer (.rdlc) nothing happens. For now I'm testing the event with a simple button, but even with the button nothing happens. Does anyone know what I'm missing The DAL is working correct and I'm using .NET 3.5

<rsweb:ReportViewer ID="ReportViewer" runat="server" Font-Names="Verdana" 
                                 InteractiveDeviceInfos="(Collection)"  WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" >
        <LocalReport ReportPath="Office\Reporting\InvoiceReport.rdlc" />                                
    protected void Button1_Click(object sender, EventArgs e)
        string strInvoiceId = "603663";

        tblInvoiceTableAdapter InvoiceAdapt = new tblInvoiceTableAdapter();
        TGU.tblInvoiceDataTable invoiceDt = InvoiceAdapt.GetIn

Adding a cookie to a response.redirect vs. httpWebRequest


Hello, I will try to be as clear as I can be.  I'm sure this question has been asked but I can't find a suitable answer for this particular situation.

I need to be able to redirect the browser to a new 3rd party page while at the same time supplying a cookie required for some form of authentication on the 3rd party site.

I have managed to get this to work in the following manner:


'SessionID is predetermined by another HttpWebRequest/Response  

Dim sessionCookie As New Cookie("ezproxy", sessionID.Substring(1), "/", ".someother.site")

Dim CookieJar As New CookieContainer


rRequest = HttpWebRequest.Create("where I want to go")

rRequest.CookieContainer = CookieJar

rRequest.Method = "GET"


'Make the request and get the response.

rResponse = rRequest.GetResponse()


'Save cookie(s)

If (rResponse.Cookies.Count <> 0) Then

For Each cook

Web Service that will receive xml request and send xml response


I am trying to create a web service that can do the following functionality:

Request XML 

<?xml version="1.0" encoding="UTF-8"?>
<Authentication UserName="test" Password="test" MyId="0987">

Response XML - After authenticating request xml from client send them back the following response:

<?xml version="1.0" encoding="UTF-8"?>
   <Test MyId="0987">
       <TestType id="11"></TestType>
       <TestType id="22"></TestType>

How can I create web service to do this.

Response.TransmitFile() Firefox problems


My company is in the final development stages for a web application that includes a couple of features that allow for uploading and downloading user document files.  We've recently identified a problem in these features when users download and view a document in Firefox.  The download and viewing work fine, but as soon as the user closes the document and attempts to navigate to a different page in the application, Firefox throws up a page that says:

 XML Parsing Error: not well formed

Location: (URL of page)

Line number: X, Column: X

[a snippet of markup from the page]


I've tried numerous variations on the code we're using to do the download, but they all center on the following:


        string path = Server.MapPath(UIUtils.GetRepositoryPath(custNm)) + fileId + ArtifactRevision.FileExt;
        FileInfo file = new FileInfo(path);
        if (!file.Exists)
            throw new ApplicationException("Missing repository file");

        fileName = fileName.Replace(' ', '_');
        Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
        Response.AddHeader("Content-Length", file.Length.ToString());
        Response.ContentType = contType;

Writing Bitmap to Response.OutputStream - Generic Error Occured in GDI+



This is what I'm trying to do when I get the error on the server (it works on my local machine):

System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image); 

Response.ContentType = "image/bmp";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp);

I don't think it can be a permissions problem because this works on the server:

System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image);

Response.ContentType = "image/jpeg";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

So how do I get this to work for a bitmap?


how to make website that response even on heavy traffic load..

hi..i wanted to know that how to make the website that performance never goes down even if the load is increased up to some extent rather than the general websites.i am confusued that is this related to the database server or the coding...can i solve problem using multihtreading...please help me..

Exit Popup and response.redirect

Hi, I have a requirement to show an Exit Popup on one of our processing pages. I am showing the exit popup by registering a client side javascript like window.onbeforeunload = ShowExitPopUp(); The popup executes fine if you close the window, or try to type in a different URL. However the issue is that my processing page is also performing a "Response.Redirect" on the server side once the process completes. When response.redirect happens the exitpopup also shows up. Is there a way to have the exit popup not show up in that case? Since my server side code is running through an UpdatePanel, so I have tried registering the following, in an attempt to remove ExitPopup from client side. However this doesn't work since server side redirection happens before end request. Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RemoveExitPopup); Has anyone faced a similar situation and handled it?

Is it possible to response SMS automatically in ASP.net when website or web application is closed?

Dear friends, In my problem statement user sends a SMS to GSM Server by mobile phone and the website or web application will return an answer even they be not opened. Is it possible to response SMS automatically in ASP.net when website or web application is closed? Thanks for your help Mahyar
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend