I want to send the name of the video from one webform to another. This is achieved using various techniques like query string, session, application, cookies yes! But the problem that I'm facing is I have a loop from where I got to send this data.
protected void Page_Load(object sender, EventArgs e)
{
foreach (string strfile in Directory.GetFiles(Server.MapPath("~/Uploads1" + User.Identity.Name)))
{
ImageButton imageButton = new ImageButton();
FileInfo fi = new FileInfo(strfile);
imageButton.ImageUrl = "Uploads1" + User.Identity.Name +"/" + fi.Name;
imageButton.Height = Unit.Pixel(100);
imageButton.Style.Add("padding", "5px");
imageButton.Width = Unit.Pixel(100);
imageButton.Click += new ImageClickEventHandler(ImageButton1_Click);
imageButton.AlternateText = fi.Name;
imageButton.ToolTip = "View " + fi.Name;
Panel1.Controls.Add(imageButton);
}
}
//Show the actual sized image on clicking the image
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("Videos.aspx?VideoURL=" + ((ImageButton)sender).ImageUrl);
}
Now I want to send the "fi.Name" which is the name of the Video to other web form, and display the name on a linkbutton which has the below code:
protected void Page_Load(object sender, EventArgs e)
{
VideoPlayer1.Mp4Url = Request.QueryString["VideoURL"];
// LinkButton1.Text =
}
Any help would be appreciated. P.S. If I use cookies, the text which is being sent is the last video name to all the files.