Click here to Skip to main content
15,914,160 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: securing webapp with web.config Pin
Chetan.visodiya3-Aug-06 2:05
Chetan.visodiya3-Aug-06 2:05 
GeneralRe: securing webapp with web.config Pin
0rb1t3-Aug-06 2:31
0rb1t3-Aug-06 2:31 
AnswerRe: securing webapp with web.config Pin
ToddHileHoffer3-Aug-06 2:20
ToddHileHoffer3-Aug-06 2:20 
GeneralRe: securing webapp with web.config Pin
0rb1t3-Aug-06 4:33
0rb1t3-Aug-06 4:33 
GeneralRe: securing webapp with web.config Pin
ToddHileHoffer3-Aug-06 8:06
ToddHileHoffer3-Aug-06 8:06 
Questionplay audio files using asp.net 1.1/c# Pin
DGtech3-Aug-06 0:26
DGtech3-Aug-06 0:26 
AnswerRe: play audio files using asp.net 1.1/c# Pin
VenkataRamana.Gali3-Aug-06 2:37
VenkataRamana.Gali3-Aug-06 2:37 
QuestionError while providing file download in webpage Pin
seee sharp2-Aug-06 23:20
seee sharp2-Aug-06 23:20 
I have to provide download of files in ASP.NET 2.0
I am using following lines of code.

try
{
Byte [] bytes = this.ContentController.GetFileContents(filePath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=File" + _fileExtension);
Response.AddHeader("Content-Length", bytes.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Buffer = true;
Response.BinaryWrite(bytes);
Response.Flush();
}
catch(FileNotFoundException fnfe)
{
this.ShowErrorMessage(this.GetErrorString(ResourceIdentifiers.DOCUMENT_FILE_NOT_FOUND_ERROR));
}
catch(Exception ex)
{
this.ShowErrorMessage(this.GetErrorString(ResourceIdentifiers.DOCUMENT_UNEXPECTED_ERROR));
}


Using above code, when one clicks on file link, a default download box of IE appears. If user clicks on Save, the file gets saved on disk and user can open that file. If user clicks on Open, it opens registered application with file type and says, file not found. Using same code I am able to open Word file but I cannot open Excel, PDF files.

Note: My application used Master pages, UIP Application Blocks. The code written above is inside a user control which gets loaded on view (webform) dynamically based on configration(xml) file.

Please can anyone suggest what could be going wrong in the piece of code because of which I am not able to open Excel/PDF files.

Apprciate your help.

Thanks and regards,
Ashish







AnswerRe: Error while providing file download in webpage Pin
ToddHileHoffer3-Aug-06 2:50
ToddHileHoffer3-Aug-06 2:50 
GeneralRe: Error while providing file download in webpage Pin
seee sharp3-Aug-06 3:09
seee sharp3-Aug-06 3:09 
GeneralRe: Error while providing file download in webpage Pin
ToddHileHoffer3-Aug-06 3:19
ToddHileHoffer3-Aug-06 3:19 
GeneralRe: Error while providing file download in webpage Pin
seee sharp4-Aug-06 4:01
seee sharp4-Aug-06 4:01 
Questionhow to call frame page using webrequest Pin
nilesh28742-Aug-06 23:06
nilesh28742-Aug-06 23:06 
AnswerRe: how to call frame page using webrequest Pin
Guffa3-Aug-06 3:00
Guffa3-Aug-06 3:00 
QuestionHow to compute end date given the start date? Pin
blurMember2-Aug-06 22:54
blurMember2-Aug-06 22:54 
AnswerRe: How to compute end date given the start date? Pin
_AK_2-Aug-06 23:17
_AK_2-Aug-06 23:17 
GeneralRe: How to compute end date given the start date? Pin
blurMember2-Aug-06 23:44
blurMember2-Aug-06 23:44 
GeneralRe: How to compute end date given the start date? Pin
_AK_2-Aug-06 23:47
_AK_2-Aug-06 23:47 
AnswerRe: How to compute end date given the start date? Pin
mnaveed2-Aug-06 23:37
mnaveed2-Aug-06 23:37 
GeneralRe: How to compute end date given the start date? Pin
blurMember2-Aug-06 23:46
blurMember2-Aug-06 23:46 
QuestionInclude aspx file within aspx file Pin
doyang2-Aug-06 22:13
doyang2-Aug-06 22:13 
AnswerRe: Include aspx file within aspx file Pin
enjoycrack3-Aug-06 2:39
enjoycrack3-Aug-06 2:39 
AnswerRe: Include aspx file within aspx file Pin
Not Active3-Aug-06 3:58
mentorNot Active3-Aug-06 3:58 
QuestionExport to excel sheet wise Pin
sharath072-Aug-06 21:50
sharath072-Aug-06 21:50 
AnswerRe: Export to excel sheet wise Pin
VenkataRamana.Gali3-Aug-06 0:09
VenkataRamana.Gali3-Aug-06 0:09 

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.