i my site i 'm uploading file in my website's root folder....now i want to download this file...for that i have use hyperlink and give file url http://localhost:35587/test/calender.jpg...but when i click on this link i get
Server Error in '/uploadingfile' Application.
HTTP Error 404 - Not Found.
this ...
my website name is uploadingfile...do i need to specifi the name of website in url....
When i specify above code in button click event where button exist in update panel, then its giving the error "icrosoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near 'I8,A,001 I8,A,001 OD'."
parthiv.kuba...
Member
110 Points
196 Posts
how to download file using c#
Jul 04, 2012 03:06 PM|LINK
hi...
i my site i 'm uploading file in my website's root folder....now i want to download this file...for that i have use hyperlink and give file url http://localhost:35587/test/calender.jpg...but when i click on this link i get
Server Error in '/uploadingfile' Application.
HTTP Error 404 - Not Found.
this ...
my website name is uploadingfile...do i need to specifi the name of website in url....
or else ?
what should i do ?
ignatandrei
All-Star
137688 Points
22150 Posts
Moderator
MVP
Re: how to download file using c#
Jul 04, 2012 03:38 PM|LINK
No. Just put an
<a href='<%=ResolveUrl("~/path to the file")%>'>click here</a>
amigo 1
Member
62 Points
202 Posts
Re: how to download file using c#
Jul 05, 2012 07:32 AM|LINK
Html tags will be valid here
Allen Li - M...
Star
10411 Points
1196 Posts
Re: how to download file using c#
Jul 06, 2012 07:36 AM|LINK
Hi, you can try the following codes with button click event to download image:
Response.Clear(); Response.ContentType = "image/jpeg"; Response.AddHeader("Content-Disposition", "attachment; filename=xxxx.jpg"); Response.WriteFile(Request.MapPath("xxxx.jpg")); Response.End();If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
prasad.magan...
Member
681 Points
215 Posts
Re: how to download file using c#
Dec 14, 2012 10:34 AM|LINK
Hi Allen Li,
When i specify above code in button click event where button exist in update panel, then its giving the error "icrosoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near 'I8,A,001 I8,A,001 OD'."
So could you please help me on this.
Prasad Maganti
prasad.magan...
Member
681 Points
215 Posts
Re: how to download file using c#
Dec 20, 2012 09:30 AM|LINK
i have found the solution on http://forums.asp.net/p/1866461/5245534.aspx/1?p=True&t=634915781322026489
Prasad Maganti