I have a .net 2.0 (C#) app that basically serves up podcasts. Some of the MP3 files are local to the app some are pointing externally. I would like to be able to 'count' downloads for both. Therfore I cam trying to come up with a page that sits in the middle to basically handle the call to the Db to update the hit count for that particular MP3 file. In my podcast XML I point the url for the enclosure to this middle page, passing in a aparamter for the 'real' URL. The middle page basically calls the DB and then basically does a redirect. The problem is Itunes doesn't like this 'middle' page. Any ideas on how to fool iTunes into thinking the 'first' URL is a 'good' MP3 file?
middle page:
protected
void Page_Init(object sender, EventArgs e)
{
Page.Response.ContentType =
"audio/mpeg";
string reqUrl = Request.QueryString["url"];
try
{
string reqID = Request.QueryString["id"];
SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["db"].ToString());
SqlCommand adapter = new SqlCommand("RSSUpdateChannelItemStats", cnn);
adapter.CommandType =
CommandType.StoredProcedure;
adapter.Parameters.Add(
new SqlParameter("@ItemID", reqID));
cnn.Open();
int rows = adapter.ExecuteNonQuery();
cnn.Close();
}
catch (Exception ex)
{
}
Response.Redirect(reqUrl,
false);
}