Questions tagged [response.write]

142 questions
21
votes
2 answers

ASP.Net Download file to client browser

I'm writing a simple test page to download a text file from a browser on button click. I am getting a really strange error that I have never seen before. Any thoughts? The error occurs on Response.End(); and the file never gets to the client…
tier1
  • 5,797
  • 6
  • 41
  • 69
18
votes
4 answers

ASP.Net MVC 3 Razor Response.Write position

I am trying to update this tutorial on implementing Facebooks BigPipe to razor. There is a html helper extension that adds a pagelet to a list, and then outputs a holding div to the response. The idea is that later on the content of this pagelet is…
Terry
  • 832
  • 1
  • 11
  • 25
18
votes
3 answers

Where is this ASP.NET feature documented? <%= string format, params object[] args %>

Apparently it is possible to write formatted output using the <%= %> construct (render block) in ASP.NET web forms pages and views. <%= "{0} is {1}", "Foo", 42 %> This will render "Foo is 42". As far as I know the ASP.NET parser translates <%= %>…
17
votes
4 answers

How to add encoding information to the response stream in ASP.NET?

I have following piece of code: public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/rtf; charset=UTF-8"; context.Response.Charset = "UTF-8"; context.Response.ContentEncoding =…
Greg
  • 545
  • 1
  • 5
  • 13
13
votes
4 answers

Response.Write and UpdatePanel

I generate a vcard that I send to the client using the following code snippet: Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", fileNameOnly)); Response.ContentType = "text/x-vcard"; Response.ContentEncoding =…
laconicdev
  • 6,085
  • 11
  • 59
  • 88
10
votes
2 answers

Sending ICalendar event to client while still continue running your code

I have built a basic calendar event using DDay.iCal, when I click "Add to calendar" link I produce an event and then sends this to the client. Basically, my application works like this. A User logs in. Selects a specific date. Books a specific…
8
votes
2 answers

Why is my debug msg not being written into my page?

I've got some debug msgs (written via Response.Write()) that I can see when I do a "View Source" like so (within VB code): currentYear = Year(Now) SQLString = "Select NewBiz from MasterUnitsprojSales where CYear = " & currentYear & " and Unit = '" &…
B. Clay Shannon
  • 1,055
  • 124
  • 399
  • 759
7
votes
4 answers

How do you provide JSON response data in .NET?

Without using any third party tools, what is the ideal way to provide JSON response data? I was thinking of having an ASPX application page to just return the json string response. Any ideas?
LB.
  • 12,272
  • 21
  • 60
  • 99
7
votes
6 answers

HttpResponse substituting underscores for spaces in file names

When downloading a file with Response.Write spaces in the file name are replaced with underscores, and when the associated application opens, a number in square brackets is appended: Response.AppendHeader("Content-disposition", "attachment;…
Graeme
  • 2,487
  • 7
  • 35
  • 50
7
votes
4 answers

What’s the difference between Response.Write() and Response.Output.Write()?

What’s the difference between Response.Write() and Response.Output.Write()?
Mahesh
6
votes
4 answers

Cannot use Response.Write in section of aspx page?

I'm trying to use the Response.Write() method to dynamically insert content in the < head > section of an aspx page. I need to inject a string value from a property on a code-behind object which is a link to my CSS file. However, it is not being…
MattSlay
  • 6,877
  • 4
  • 39
  • 52
5
votes
4 answers

cant get c# to make a downloadable csv

I am having to code up a button which, onclick, downloads a csv file onto the client's computer (this is a web app) So, did some research, pulled all strings together, go figure, its not working. I am trying to get this for now: protected void…
LocustHorde
  • 5,813
  • 14
  • 54
  • 86
5
votes
1 answer

How could I insert a string into the response stream anywhere I want?

There may be an easy way to do this but I can't see it... I created a simple Http Module that starts a timer on the PreRequestHandler and stops the timer on the PostRequestHandler to calculate the time it took the page to load. I then create some…
DM.
  • 1,837
  • 1
  • 13
  • 18
5
votes
1 answer

ASP.net memory usage during download

On an ASP.net site at my place of work, the following chunk of code is responsible for handling file downloads (NOTE: Response.TransmitFile is not used here because the contents of the download are being streamed from a zip file): private void…
Odrade
  • 6,930
  • 11
  • 39
  • 65
4
votes
0 answers

When writing to httpResponse, does the response have a size limit?

I'm generating a CSV-file on the fly in ASP .Net C#, and writing it directly to the response. private void ExportToResponse(string textCsv, string fileName) { HttpContext.Current.Response.Clear(); …
linnkb
  • 505
  • 3
  • 8
  • 23
1
2 3
9 10