Hello Friends.
I'm using the following code in my app to download a .wav file.
This all code is on MySpace.aspx page. When Request made on this page a method works there getData(); which simply fetch the records.
There are Three other methods
1. trackCount() == this checks the count only
2. MessageRead() == this marks the flag as R in the database;
3. getData() == this fetch the records and check if flag is U then change the row color in Gridview.
In the code I have used
Response.Redirect("MySpace.aspx?val=Inbox", false);
What I want to do simply download the file if download done the flag updated to R and getData() method to call so that the color of row in gridview changes as per the flag.
But if I use getData(); then it doesn't reload after the file downloaded.
And If I make
Response.Redirect("MySpace.aspx?val=Inbox", false);
then gridview reloaded and row color changes but file doesn't get downalod.
Please suggest me how can I accomplish this. Basically I want to call getData() method after Response.Write() method.
I removed Response.End() because this was terminating the Request and as I require I have to call some other methods after downloading the file.
Following is the Code.
Response.AddHeader("content-disposition", "attachment; filename=" + info.Name);
Response.AddHeader("content-length", info.Length.ToString());
Response.ContentType = "audio/x-wav";
Response.WriteFile(info.FullName);
doflag = true;
if (doflag)
{
trackCount("INSERT INTO TrackUserAction(Phnum,trackdownload) VALUES('" + Session["phnum"].ToString() + "',1)", "in");
MessageRead(((Label)gvMyDetails.Rows[index].FindControl("lblSender")).Text.Trim(),((Label)gvMyDetails.Rows[index].FindControl("lblMsgTime")).Text.Trim(), msgID);
Response.Redirect("MySpace.aspx?val=Inbox", false);
}
Thanks and Regards