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

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

Response.Write output control

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

Hi All


I want to use response.write to generate a table.

but I have a question, the result of table must display on the top of web page.

How can I control the location of table? e.g. at the middle or end of web page or starting from number of line.


please advice me, thx


View Complete Post

More Related Resource Links

output cache to be used only when parameter has changed + old question of user control not answered



i have 2 questions about output cache:

1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.

2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?

3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :


and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.

can anyone please help me?

Response.Write new line in vb

 how come the following won't write to different lines?  It is all in the same sub.Response.Write("The start date is: " + startDate + vbCrLf) ----other code----- Response.Write("The end date is: " + endDate + vbCrLf) ----other code----- Response.Write("The result: " + result + vbCrLf)  

TabContainer + response.write


i have an interface with tabcontainer and 4 tabpanel , I put a button on tabpanel to display a message ( its very simple but doesn`t work).


Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
End Sub

But when i click i recieve this message:

"sys.webforms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modifed by calls to response.write(), response filters, Htt

Can i not show Response.write on a page?



I'm doing something for  paypal.

So i have my values for paypal PDT like this:

 Public Function PayPalPostForm() As String
        Dim s = Request.QueryString("tx")
        Dim PostUrl As String = "https://www.sandbox.paypal.com/cgi-bin/webscr"
        Dim Cmd As String = "_notify-synch"
        Dim Method As String = "post"
        Dim submitvalue As String = "PDT"
        Dim tx As String = s
        'my sandbox merchand identity token 
        Dim at As String = "J9Z11-6776aOBoIOMqiWDEFGUmonSwyqM2QiGriz7Rn-f7Y_z0KEQkUvLSa"

        'Create the Form to write to the page with PayPal parameters      
        Dim ppForm As New StringBuilder()
        ppForm.AppendFormat("<Form name='frmPP' id='frmPP' action='{0}' method='{1}'>", PostUrl, Method)        
        ppForm.AppendFormat("<input type='hidden' name='cmd' value='{0}'>", Cmd)
        ppForm.AppendFormat("<input type='hidden' name='tx' value='{0}'>", tx)
        Return ppForm.ToString()
    End Function

and then i will send the form to paypal and ge

encrypted response.write


I'm using JQuery and .NET ashx file (Generic Handler) to hand some  Web based input / output STUFF.
Works great. Smile My problem is, when I do view source in browser, I can clearly see the handler file for example
$.get('/MyApp/MyHandler.ashx'); How can I encrypt it so that it is not so obvious ?

Using response.outputstream.write to stream large file fails in firefox



I have some code to stream files (for security of the files), the code works for all files in IE, and small files in firefox. but If the file is large (eg 750Mb) firefox hangs before it shows the open/save dialog box. 

However if i take out response.clearheaders and the response.flush in the code it does download but all the files downloaded by firefox are corrupt because the file size is too large.   Filenames are guids but I took the "-" out incase that was an issue.

If any one can shed some light on this I would be very grateful.

Function is Below. 


Private Sub StreamFile(ByRef response As HttpResponse, ByVal sFile As String)
            Dim fs As FileStream = Nothing
            Dim sFileName As String = Path.GetFileName(sFile)

            Dim oFile As New FileInfo(sFile)

                fs = New FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)

            Catch ex As Exception

            End Try


            'response.ClearHeaders() 'makes file size wrong in firefox
            response.AddHeader("Content-Length", oFile.Length)
            'To forcefully download, even for Excel, PDF files, reg

Grab output HTML and write to SQL Server


Hi all -

I've got a requirement to add a feature that will save off a dynamically created asp.net page so it can be recalled and reviewed at a later date. I was thinking of just adding a 'Save' button to the page and in the code-behind using VB to write the output HTML to a varchar(MAX) field in my database.

Does anyone know how (in VB) to grab the entire page HTML so it can be inserted into a database?

Thanks for any help!



JavaScript generated output using document.write does not appear in UpatePanel with AJAX


I have a ListView (in an UpdatePanel) connected to a LinqDataSource. When the page loads and/or I navigate through Postback, the code snippet (below) will display the following output:

[email.gif] someone@adomain.com   [email.gif] www.adomain.com

However, when I use a few DropDownLists (also in the UpdatePanel) to filter the results (reset the DataSource to a Linq query and call DataBind), the same Contact is displayed like this:

[email.gif] [email.gif] www.adomain.com


<asp:ListView ID="lvEContacts" runat="server" DataSource='<%# Eval("Business_EContacts") %>'>
    <ul id="itemPlaceholderContainer" runat="server">
      <li id="itemPlaceholder" runat="server"></li>
    <li style="display: inline; list-style-type: none;">
      <asp:Image ID="imgEContact" runat="server" ImageUrl="~/DesktopModules/images/email.gif" ImageAlign="Middle" />
      <%# FormatEContact( Eval("EContact.Address") ) %>

How do I write a string coming from a Javascript function in my Label control?


Hi all,

This is what I tried doing in my Javascript function (partially):

catch (err) {
              document.getElementById("lblError").innerHTML = err.description;

IE output of my lblError label component is a long id name like this:

<td>Last Error: <span id="ctl00_ctl00_ContentPlaceHolder_GlobalMasterPage_ContentPlaceHolder_DashboardMasterPage_lblError">No errors at this time.</span>

how do I look up for lblLabel in this case?

Thank you

passing a response.write to a label


I'm trying to pass a calculation from a response.write to a label.

    Public Sub StartTimeDif()
        Dim dt As DateTime = Convert.ToDateTime(starttimeInput.Text)
        Dim dt1 As DateTime = Convert.ToDateTime(endtimeInput.Text)
        Dim ts As TimeSpan = dt1.Subtract(dt)
    End Sub

I want to pass (ts.minutes) to durationLabel

Thank you,


Response.Write(string.Format("", url));


Hello all,

Any suggestions are greatly appreciated...

Here is the website situation:

Webpage A: look & feel alignments are in the central of the screen.  It has a submit button.  The last code in the submit command() is this message subject:

Response.Write(string.Format("<script>window.open('{0}', '_blank');</script>", url));

where url = another webpage B.

The outcome is fine.  Webpage B is populated properly.  However, Webpage A postback as aligment to the left, it is no longer the center. 

I could not find a way to debug the issue.

Once again, thanks in advance.

Microsoft JScript Runtime Error-Cannot Call Response .Write


i am simply doing a searching of records on button click if record found it will be display in gridview pther wise  it will print me a message no value found

but everytime when it execute my Else Block it always throws me this script error how i can resolve it

Currently Using Ajax Update Panel Script Manager C#

my Html

                    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:GridView ID="GridView1" runat="server" Width="385px">
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
        </asp:UpdatePanel> </td>

My Code Behind

protected void Button1_Clic

CS0016: Could not write to output file 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP



I keep getting this error:

CS0016: Could not write to output file 'c:\WINDOWS.0\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\42d038b5\b838d243\App_Web_master.master.cdcab7d2.lwqjolwv.dll' -- 'Access is denied. '

So, what I did is to set Full control to NETWORK_SERVICES user to both 'Framework\v2.0.50727\Temporary ASP.NET Files' and %temp% folder.

But still the error exist ....

What do I do next?

could it be a specific code I am trying to excute on the master page?





_AppStart.cshtml: can't get response/request to write/read cookie?


currently, I'm setting up an HttpCookie in a "master" page (layout) and check wiehter I need to send the user back to some specific page depending on the value, if it has expired, etc.
Because the master layout page is not the 1st "page" code to process, I can sometime get runtime error because the cookie is already expired.

I thought I would move this part to the _AppStart.cshtml file but I can't get to read/write (Response/Request) the cookie there?

Should I do this in a _PageStart.cshtml in all my folders rather?


Write a web browser WITHOUT using WebBrowser control.


Hi All,

I have a unique project in mind which is based on a web browser, but requires that I perform some of the actions that the WebBrowser control does instead.

Basically, I want to be able to intercept/handle the web browser's requests and return data to the control which outputs the data to the clients screen.

For example:

1) A client requests a page.
2) My code handles this request and returns the HTML to the control.
3) The control then sends requests for each component which makes up the page (images, etc) and sends the requests to my handler.
4) My handler gets the data and returns it to the control.

Is there a way I can achieve this?


If you already know the candle light is fire, the meal was cooked a long time ago...

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.
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