Last post Oct 22, 2009 12:59 PM by lakshya13
Oct 21, 2009 12:40 AM|lakshya13|LINK
First time I have used HTTP handler, so I have tough time to send object from HTTP handler to .aspx page
Actually I am trying to upload a file, so in my default.aspx page if i click on upload button at that time http handler comes in picture and it saves file in system as well as in database. this handler code is written in upload.cs file.
Now I want to transfer file object from upload.cs to Default.aspx page, how I can transfer that object ?
Thanks in advance
Oct 21, 2009 08:13 AM|Sand1980|LINK
The simplest way would be to store the object in session and access the same in Default.aspx. The other way round would be to serialize the object and send the xml stream as the response to default.aspx page and try deserializing the object by reading the
response stream. As far as I know other than this there is no way to pass objects.
Oct 21, 2009 10:17 AM|lakshya13|LINK
Thank you for your reply,
Yes you are right, we can use Session variable, currently as a temporary I have used this, but you know session is not reliable variable.
Two quick questions comes in my mind
1) How to send and retrieve serialize object to default.aspx page
2) How can I get that object in default.aspx page, means i send serialize object from my handler then how I can know that my handler return some value or object ?, Because I am unable to find any event in default.aspx page which tells me now handlers returns
One is post back event from which i can figure out, but I am not feeling secure to write code in this event.
Oct 21, 2009 10:28 AM|Sand1980|LINK
To help you more it would be great if you could post some code of what you are doing in the HttpHandler. Based on your code I can give you some sample code.
Oct 22, 2009 12:59 PM|lakshya13|LINK
I used my http handler to save file,
so when i hit on upload button at that time my handler will called and it call ProcessRequest() function.
So it look like this
public void ProcessRequest(HttpContext context)
if(context.Request.Files.Count > 0)
// get the applications path
save file in database and as well as some location
[ NOW HERE WHEN IT EXIT THEN IT WILL GO BACK MY default.aspx PAGE]
In that page I need file name so I can do further work in that default.aspx page.