.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Respoce.Redirect from ashx file

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
Hi everyoneHow To  Redirect from httphandler(.ashx)  to an (.aspx) page in the same application ?Thanks.

View Complete Post

More Related Resource Links

File Upload to an .ashx Script.


Hoping that someone can help me with this. I've been tearing my hair out for days looking for sources and coming up with nothing.

Basically, the scenario is this: I'm working on a project whereby an iPhone will make an HTTP-POST call to an .ashx file on my site. The POST will consist of some fields and a file.

I'm having difficulty - read that as no luck what-so-ever - in finding the form fields or the file when I look at the HTTPContext object in the debug mode of Visual Studio. And if I look at HTTPContext.Request.Files.Count (where I would expect to find a file count) the value is always zero!!

Please help, very confused by this!



how to pass value code behind to ashx file

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

How to redirect bad date(xxx,9999) in datereceived column in text file in ssis

I want to redirect bad date format from flate file source to log table. I tried with redirect row but it is not working. Thanks in advance

Session State in ASHX file


Hi People,

I have been trying unsuccessfully to retrieve a Session varaible from within an ASHX file that i'm using to build an XML file.

What I am trying to achieve is quite simple really.

My ASHX file is used to dynamically build an XML file so that I can then bind it to a TreeView control later on. However the dynamic part isn't quite working because the ID that I need from the session seems to not be passed into the ASHX file.

I have tried using the following methods to do this:

1) Include interfaces IRequiresSessionState and IReadOnlySessionState

2) Tried accessing the value like this: Session["ID"] or context.Session["ID"] or HttpContext.Current.Session["ID"]

I am setting the Session variable in the MasterPage's code behind.

Can anyone help?



Accessing static variable in global.ashx file


Hi All ,

I want to access the static variable in my global.ashx file  I am using classname.variable name for accessing the variable but the variable name dose not appear.Can someone tell me how to access static varialbe in *.ashx file.

Redirect shareware download url from a file to a download page


Hi all,

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?



Download a file then either redirect or refresh the page (after response.end)??


Hi all,

I am using some code similar to the code below to open a word document on my ASP.net app.  Once the file has been downloaded and opened I then want to either redirect to another page or refresh the screen but nothing works after response.end and if i add it before response.end the browser never downloads the file?

Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name                  
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";

Any ideas?  Thanks

Instruct DataFlow task to Redirect bad input rows to Log file?

Hi all,

I am new to SSIS 2005 packages but have written many in DTS 2000.

I am importing a CSV flat file into a SQL server table with SSIS 2005. How do I tell the Dataflow task to redirect rows that don't have the proper number of columns into a Text log file so I can inspect the bad rows later?

I have pointed the Red Error arrow to a text file and defined all the Columns to redirect the error to the text file. I have set the Max error count to 200. However, the entire package fails at the first bad row in the PrimeOutput() method, indicating that Column 13(the last one in the Row) is missing in a particular row. I have tried setting Ignore the error, but that doesn't work either.

I have created a DTS 2000 package that works on the same CSV input and the same SQL table destination. It seems to have no problem with my instructions.

I must be missing something. Can someone tell me what it might be? I really would like to use SQL 2005 or even SQL 2008 because of the new features available, but I am stuck on what I thought would be a very easy first step (because it is very easy in DTS 2000).

Any help would be appreciated. Thanks...

How to get data from ashx file


i have a ashx file

this file return string (plain/text)

i want ro read this from another page



http://www.domain.com/My-ashx.ashx?q=1 (This URL Return One Line Plain/Text)

i have another page: http://www.domain2.com/default.aspx ( I want write string(Return From ashx file))


Please Help me ;)


Error in SENDING VALUES .ashx File


Hello Brother

I am Rupesh B S

i have doubt

i have a .ashx file is in project called ShowImage.ashx

Currentely i am using this file for to show to show images in uploading area used to immediately show image after uploading it to the uploader on the web page

here some part of my code


HttpPostedFile File = FileUpload1.PostedFile;


Image1.ImageUrl = "~/ShowImage.ashx?id=" + id;


but now i want to pass the user id containg textbox value to this .ashx file(it is an int Value not string)

how can i

Please Help me to send my textbox int values to .ashx file and receive the result


Thank you

Rupesh B S





Reading XML through ASHX file


Hi guys,

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

I tried to parse this XML using the doc.Load("http://www.domain.com.br/asp.net/integration.ashx") 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.

Do you have any doubts to solve that?

Appreciate your help


How to set Handler mapping to redirect .php file to .aspx file on IIS7


Our website used to be  a php website, now everything changed to .net, but the customer still want to keep the original php Request url.  I want to know How to set Handler mapping on IIS7 to redirect .php file to .aspx file ? In more details,  when you click handler mappings on IIS 7.0, what kind of hanlder should you  add (add managed handler or add script map or add wild card script map or add module mapping) to redirect .php file to .aspx file? Thanks.



Session call in .ashx file from .cs file.


How we can call session from .ashx file from .cs file.


i have store value in session in cs file.

eg. session["s"]="abc";

when i get this value in .ashx file  

string strDisplay = context.Session["Captcha"].ToString();

show error 

Object reference not set to an instance of an object.

Problem redirect debug output to a file using trace listener


I have created a debug listener to redirect the output from the Debug/Console window to a file(with a call stack), using the following code:

void SomeMethod()
    // Create a file for output .txt.
    Stream debugFile = File.Create(fileName);

    // create TextWriterTraceListener named "file"
    TextWriterTraceListener debugWriter = new TextWriterTraceListener(debugFile, "file");

    // add to debug listeners
    // set callstack to be shown
    Debug.Listeners["file"].TraceOutputOptions |= TraceOptions.Callstack;
    // set auto-flush
    Debug.AutoFlush = true;

but the output won't redirect to the file I specified, it is always empty. I am calling this from the constructor in my main form. Is the place where I'm calling it from a problem?

What I am trying to achieve here is to have the exceptions from the Debug output window placed in a file with a call stack, so that I can find them and correct them.

Anyone have any ideas?

Bojan Skr

File Splitter in .Net

I love to do utility programs in .Net. And this is one of them. As I was playing with JSplit (a free file splitter program), I wondered if I could do it in .Net. The framework supports file operations like reading files in bytes and creating them. It is indeed easy to do file operations in .Net Basics on File operations

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend