Click to See Complete Forum and Search --> : session


solomon_13000
02-05-2007, 08:17 AM
How do I use Session["videopath"] found in BlogListing.aspx.cs in

BlogListing.aspx. For example:

<param name="movie" value="Untitled-1.swf?thePath=qbert.flv" />

I want to replace qbert.flv with Session["videopath"]. The full

coding is as bellow.


BlogListing.aspx
----------------

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BlogListing.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>

<body>
<form id="form1" runat="server">
<table border="0" width="786" height="283">
<tr>
<td rowspan="9" height="277" style="text-align: center; width: 410px;">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="390" height="277" id="Untitled-1" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Untitled-1.swf?thePath=qbert.flv" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="Untitled-1.swf?thePath=qbert.flv" quality="high" bgcolor="#ffffff" width="320" height="240" name="Untitled-1" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</td>
<td width="360" bgcolor="#FFCC99">
<p align="center"><b>Personal Blogging</b></td>
</tr>
</table>
</form>
</body>
</html>



BlogListing.aspx.cs
-------------------

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
LoadData();
}

private void LoadData()
{
String videoID = Request.QueryString["VideoID"];

SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConnection"].ConnectionString);
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = cnn;
myCommand.CommandText = "SELECT Video.VideoID, Video.RegistrationID, Video.VideoPath, Category.Description FROM Video, Category WHERE Video.VideoID=" + videoID + " AND Video.CategoryID = Category.CategoryID";
myCommand.CommandType = CommandType.Text;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "Video");

Session["videopath"] = ds.Tables[0].Rows[0].ItemArray.GetValue(3).ToString();

rptItems.DataSource = ds;
rptItems.DataBind();
}
protected void rptItems_ItemCommand(object source, RepeaterCommandEventArgs e)
{
LoadData();
}
}

Ribeyed
02-06-2007, 06:37 PM
Hi,
can give you code for VB.net if it will help you.
Not sure if this will work because its in the macorimedia object but give it a try.

<param name="movie" value="CreateURL(Untitled-1.swf?)" />

Then in your code behind create a function called CreateURL like this:

Function CreateURL(ByRef PartURL As String) As String
Dim NavURL As String
NavURL = PartURL & "VideoPath=" & Session("videopath")
Return NavURL
End Function


Hope this helps