Click here to Skip to main content
15,891,717 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Link in Textarea....... Pin
carlecomm2-Mar-10 18:05
carlecomm2-Mar-10 18:05 
QuestionBind ASP.NET to a property of a class Pin
ezazazel25-Feb-10 23:38
ezazazel25-Feb-10 23:38 
AnswerRe: Bind ASP.NET to a property of a class [modified] Pin
R. Giskard Reventlov25-Feb-10 23:57
R. Giskard Reventlov25-Feb-10 23:57 
GeneralRe: Bind ASP.NET to a property of a class Pin
ezazazel26-Feb-10 0:14
ezazazel26-Feb-10 0:14 
QuestionASP.NET TOOLS Pin
ravanth25-Feb-10 21:53
ravanth25-Feb-10 21:53 
AnswerRe: ASP.NET TOOLS Pin
nainakarri25-Feb-10 22:14
nainakarri25-Feb-10 22:14 
GeneralRe: ASP.NET TOOLS Pin
ravanth26-Feb-10 1:20
ravanth26-Feb-10 1:20 
QuestionDownload link of the generated file changed when I moved the code to a new pop-up page [modified] Pin
Rafferty Uy25-Feb-10 16:01
Rafferty Uy25-Feb-10 16:01 
Hi, this will be a bit tricky to explain but I'll try my best.

Original page:
I have a page with a button, which when clicked will generate a spreadsheet and prompt the user to download this spreadsheet.

Changes:
Now since we didn't want to the page to refresh,
and at the same time we didn't want to implement an UpdatePanel to this page,
we changed this button to a link which pops-up a new page.

New page:
The new page simply contains this button and a javascript link to close the window.
I did not change the source code of the generate-spreadsheet method.

Generate spreadsheet method:
public static void Export(Page webPage)
{
    webPage.Response.Clear();
    webPage.Response.Buffer = true;
    webPage.Response.Charset = "";
    webPage.EnableViewState = false;

    string filename = "spreadsheet.xls";
    webPage.Response.ContentType = "application/vnd.ms-excel";
    webPage.Response.ContentEncoding = Encoding.Default;
    webPage.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + ";");

    string filePath = string.Format("{0}temp\\{1}", webPage.Request.PhysicalApplicationPath, fileName);
    populate(filePath);

    webPage.Response.TransmitFile(filePath);
    webPage.Response.Flush();
    File.Delete(filePath);

    webPage.Response.End();
}


Problem:
Now here's my problem, the code works perfectly on my local machine, but does not work when I deployed on the server.
On my local, it correctly gives me a download dialog with "spreadsheet.xls" displayed.
On the server, it gives me a download dialog, but the URL (http://www.oursite.com/WebForms/WFrmExport.aspx) of the pop-up page is displayed instead. So when I click "Save", it will just give me an error.

Additional notes:

1. The same export method is used in the original page and the new pop-up page
2. Both original pages and pop-up pages are webforms (*.aspx)
3. The original page works on the server... meaning it correctly prompts me to download "spreadsheet.xls". The problem only occurs on the pop-up page and only on the server.
4. If I remove the File.Delete(filePath); statement, I will see the generated spreadsheet.xls in the correct filepath server directory, which is the same directory used by the original page.


What could be the problem?
Rafferty
modified on Friday, February 26, 2010 12:40 AM

AnswerRe: Download link of the generated file changed when I moved the code to a new pop-up page Pin
Pranay Rana25-Feb-10 20:06
professionalPranay Rana25-Feb-10 20:06 
GeneralRe: Download link of the generated file changed when I moved the code to a new pop-up page Pin
Rafferty Uy25-Feb-10 20:14
Rafferty Uy25-Feb-10 20:14 
AnswerRe: Download link of the generated file changed when I moved the code to a new pop-up page Pin
Rafferty Uy25-Feb-10 22:11
Rafferty Uy25-Feb-10 22:11 
GeneralNeed help with adding jquery datepicker on asp usercontrol Pin
ysfkel25-Feb-10 13:44
ysfkel25-Feb-10 13:44 
GeneralRe: Need help with adding jquery datepicker on asp usercontrol Pin
Not Active25-Feb-10 14:06
mentorNot Active25-Feb-10 14:06 
QuestionHow to Search PartList Entity Using ASP.NET Dropdowlist and Textbox Pin
Sid Childers25-Feb-10 11:21
Sid Childers25-Feb-10 11:21 
QuestionChange border properties of ASCX from code-behind? Pin
mittalpa25-Feb-10 8:15
mittalpa25-Feb-10 8:15 
AnswerRe: Change border properties of ASCX from code-behind? Pin
Not Active25-Feb-10 9:46
mentorNot Active25-Feb-10 9:46 
GeneralRe: Change border properties of ASCX from code-behind? Pin
Nasri871-Mar-10 21:26
Nasri871-Mar-10 21:26 
AnswerRe: Change border properties of ASCX from code-behind? Pin
carlecomm2-Mar-10 18:06
carlecomm2-Mar-10 18:06 
QuestionHelp with RSS feed C# Pin
DaithiBoo25-Feb-10 7:16
DaithiBoo25-Feb-10 7:16 
AnswerRe: Help with RSS feed C# [modified] Pin
i gr825-Feb-10 19:36
i gr825-Feb-10 19:36 
Questionlist item Pin
FEMDEV25-Feb-10 3:07
FEMDEV25-Feb-10 3:07 
Questionhow to publish website through IIS Pin
hi_everybody25-Feb-10 2:27
hi_everybody25-Feb-10 2:27 
AnswerRe: how to publish website through IIS Pin
R. Giskard Reventlov25-Feb-10 2:47
R. Giskard Reventlov25-Feb-10 2:47 
AnswerRe: how to publish website through IIS Pin
Abhijit Jana25-Feb-10 3:19
professionalAbhijit Jana25-Feb-10 3:19 
AnswerRe: how to publish website through IIS Pin
Brij25-Feb-10 6:25
mentorBrij25-Feb-10 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.