Ashx Vs Aspx For File Download

Dec 15, 2010

In a basic scenario where I have a GridView with files to download and link buttons to download them, is there any benefit at all for creating a custom http handler for streaming those files as opposed to simply streaming from the event handler of the download link button?

Edit: As some suggested code reuse would favor the handler, however it's not an issue in this particular case. The handler is also faster being that it avoids the page life cycle, however this slight performance improvement is probably not worth creating a handler for in my particular situation. The only thing that comes to mind now is (assuming using the same aspx page approach) whether there is any special consideration in a situation where the GridView is inside an UpdatePanel?

View 3 Replies

Similar Messages:

IE Errors On File Download Through .ashx File With Caching Turned Off?

Feb 1, 2011

I have a simple 'file download' generic handler which sets the response contenttype and headers before sending the file through the same response.

I also have Response.Cache.SetCacheability(HttpCacheability.server) set in the global.asax.

As I have noticed from various sources, Internet Explorer doesn't like this no-cache setting and gives an error when trying to download the file (requested site unavailable or cannot be found).

I thought maybe I could override this setting in the .ashx page, so I alter the response's cacheability setting to public. This did not solve the issue. removing the line from global.asax does solve the problem but obviously affects the whole site.

Is there a way of setting the cachability just for my generic handler?

View 1 Replies

Ashx Handler Prompting Download Instead Of Displaying File?

Aug 10, 2010

implemented a generic handler in my application which works great for images, but when I manually type the handler URL in the browser with the image's querystring it prompts download instead of displaying. Here is my code:

public void ProcessRequest(HttpContext context)
if (this.FileName != null)


View 3 Replies

Browsing To .ASHX Files On Windows Phone 7/Can't Download File

Dec 2, 2010

We have a whole bunch of WML pages that are served out using ASHX files and we've had no problems with them. However, someone has just got a Windows 7 Phone and when they browse to one of these pages they get:

Can't download file! Windows Phone doesn't support .ashx files Is there some IIS configuration that we need to do to make this work?

View 2 Replies

Web Forms :: Can't Start File Download From Server Side Using .aspx File In IE7

Mar 26, 2011

This below code i have used in my aspx page for file download.

Response.AppendHeader("content-disposition", "attachment; filename="" + emailAttachment.FileName + "";");
Response.ContentType = "application/octet-stream";
Response.OutputStream.Write(emailAttachment.Data, 0, emailAttachment.Data.Length);

This block of code display Download file Dialog for Open or Save the attached file.It's working fine in Mozila Firefox and IE8 but doesn't display Download file Dialog box in IE 7

View 2 Replies

C# - ASHX Image Download On Click?

Mar 21, 2011

I am using ashx to serve images from a database, is there anyway to have a user click on a link that allows them to download the file on the computer. (IE it shows the Save Dialog) Like you download a file.

View 2 Replies

What's Differences Between .aspx And .ashx Pages

Mar 29, 2011

what are the differences between .aspx and .ashx pages. I use ashx now when I need to handle a request that called from code and return with a response.

View 3 Replies

Web Forms :: How To Pass Value From ASPX To ASHX

Apr 21, 2012

Because i want concatinate that value with image filename.

View 1 Replies

Web Forms :: Httphandler (.ashx) To An (.aspx) Page?

Sep 8, 2010

How To Redirect from httphandler(.ashx) to an (.aspx) page in the same application ?


can some expert confirm better approach

View 2 Replies

HttpHandlers / Modules :: .aspx Sessions Being Called In .ashx Handler?

Aug 20, 2010

I have an Handler.ashx file and on .aspx page load it calles the .ashx file for image reading. I am attempting to pass a session from the .aspx file to the .ashx file in order to make my query of grabing the image secure. The problem is that everytime I call a session: HttpContext.Current.Session["ID"], the value is returning null or errors saying the o so commong "Object reference not set to an instance of the object". I have tried a couple ways of grabing the session:

1.) context.Session["ID"]
2.) HttpContext.Session["ID"]
3.) HttpContext.Current.Cache["ID"]

none of them are giving me the ID session set in the .aspx page. should i be using Server.Transfer instead? is there a way to grab a session variable set in a .aspx page and called in a .ashx page?

View 6 Replies

Show Download Dialog Box In Case Of File Download - Located On Amazon Server

Jan 4, 2010

i am using amazon s3 service. now i want to show download dialog box in my application when user come on download page. i am using amazon sdk.

View 1 Replies

HttpHandlers / Modules :: Redirect Shareware Download URL From A File To A Download Page?

Oct 13, 2010

I'm about to submit my pad file to multiple sharware sites but the pad file has to have a direct link to the download file and can't link to a download page which is what I would like to do, so I can track the traffic and get the downloader's email before allowing the download. I am running an ASP.NET site in VB. Is there a way to tell the web app to redirect to a specific aspx page when it receives a request for a specific file?

View 1 Replies

AJAX :: Download LinkButton In UpdatePanel Throwing Error While File Download?

Jun 10, 2013

I have added linkbutton inside gridview to download, below is my code..

protected void lnkDownload_Click(object sender, EventArgs e)


its giving me following error

"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"

View 1 Replies

Web Forms :: Download File Using New Window When Download Button Is Clicked

Sep 2, 2013

I need to download  a .mp3 file from a folder. during download a new blank page should open and after downloading it should close automatically.

View 1 Replies

How To Get The QueryString From An Ashx File

Nov 3, 2010

There is an ashx file containing "ProcessRequest(HttpContext context)" method which gets triggered automatically. When and how does it get fired?Another question, How can I get the current QueryString when I am inside this file? When I type "context.Request.QueryString" it says it's null or empty although the address have arguments.

View 1 Replies

.Net Session Is Null In Ashx File/

Jan 28, 2010

If I access session variable in ashx handler through it is always null. How can I access the current user here.

public void ProcessRequest (HttpContext context) {
context.Session[UIConstants.SessionItems.ID] = Id;

View 2 Replies

JQuery :: How To Get Data From Ashx File

Oct 17, 2010

i have a ashx file

this file return string (plain/text)

i want ro read this from another page

Like: (This URL Return One Line Plain/Text)

i have another page: ( I want write string(Return From ashx file))

View 4 Replies

Web Forms :: Reading XML Through ASHX File?

Oct 31, 2010

THere is an external ASHX url that dinamically generates an XML file.

I tried to parse this XML using the doc.Load("") but it haven't worked.

The same code above work fine if I use a XML file instead of ashx one.

I need to read the XML file generated by the ASHX one in order to integrate the websites.

View 9 Replies

Web Forms :: Can Access GridView In Customer.aspx File From Another NewUserLogin.aspx File

Jun 23, 2010

How can I access my GridView in Customer.aspx file from another NewUserLogin.aspx file.

How should I chnge the access to my GridView to public so that I can chnge its values from another aspx file

View 5 Replies

AJAX :: Ashx To Storing File In The Server?

Jul 14, 2010

I have created file upload funactionality along with progress bar in my project for this. I have referred following jquery tool you can see here.[URL]with the respective funcationality. i have created one .ashx file for string file on server but when i try to store file on server it gives me error.Could not find a part of the path so i put whole path in the respective code but still i m getting some error. my code is

sfilenamestored = ("\Users\dev5\Desktop\DataAccessLayer\PresentationLayer\"+"/Uploaded_Document/" + upload_files.foldername.ToString()) + "/" + GetUniqueKey() + file.FileName;

View 2 Replies

Receiving POST Data In .ashx File?

Feb 21, 2011

I have implemented a generic handler to work as a restful web service in ASP.Net. I have a problem receiving the XML file that is being posted to this web service. I cannot actually see anything being passed. I have gone through the form, querystring, and file properties of the request object. Everything is empty. I know that the file has been posted correctly because I can see it while using a port sniffer.

How can I access this file?

View 1 Replies

Web Forms :: Proper File Serve Of An ASHX Handler

Apr 30, 2010

For our application we provide users with file downloads that utilize handlers to serve the files. Currently, the way it is served to the user is through window.location. When using this, at times, it causes issues under IE8. When an error occurs, it cannot be caught under the page that called it.

A) Is there a way to serve an ashx file handler to the user where the page that called it can catch any exceptions made from thje handler
B) What is the correct way to serve the handler, eg., window.location, etc. Would return false at the end of the javascript solve this? Are there any other ways

View 2 Replies

HttpHandlers / Modules :: Unable To Use Inheritance In An Ashx File

Mar 12, 2010

I have the below code which does not work. I cannot instantiate my class this way.

SecurePage secureCs = new SecurePage();

I want to be able to inherit the class instead of instantiating.


View 5 Replies

HttpHandlers / Modules :: How To Pass Value Code Behind To Ashx File

Sep 6, 2010

i have generic handler file ashx file , i want to pass value from my codebehind to ashx file and i want to use switch case inside the ashx handle

View 1 Replies

HttpHandlers / Modules :: .ashx File Is Not Working In Iis7

Jan 16, 2011

.ashx file is working perfectly in visual studio iis but when hosted it is not working

View 2 Replies

Copyrights 2005-15, All rights reserved