Plz give the correct code for the following :
Error:
Server Error in '/reslife' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 54: idElem.InnerText = "";//strId;
Line 55: mediaElem.AppendChild(idElem);
Line 56: strPath = xNode.SelectNodes("mediaVideoFile").Item(0).InnerText;
Line 57: pathElem = xmlResDoc.CreateElement("filePath");
Line 58: CreateErroLog("strStatus : " + strPath);
Source File: c:\inetpub\wwwroot\reslife\storyadmin\api\videolist.aspx.cs Line: 56 Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
videolist.Page_Load(Object s, EventArgs e) in c:\inetpub\wwwroot\reslife\storyadmin\api\videolist.aspx.cs:56
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Xml: <?xml version="1.0" encoding="utf-8" ?>
- <availableMedia>
- <mediaItem>
<mediaTitle>Shaun Hansen</mediaTitle>
<mediaDate>2008-11-23</mediaDate>
<mediaCategory>Other</mediaCategory>
<mediaMinistry>ResLife</mediaMinistry>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081123_sun_sh_1700.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081123_sun_sh_1700_5k.flv</mediaVideoFile>
</mediaItem>
<mediaTitle>The Pursuit of Joy Pt4</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081123_sun_dvk_0930.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081123_sun_dvk_0930_5k.flv</mediaVideoFile>
<mediaTitle>Family Flipt Event</mediaTitle>
<mediaDate>2008-11-19</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081119_wed_cc_1900.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081119_wed_cc_1900_5k.flv</mediaVideoFile>
<mediaTitle>The Pursuit of Joy Pt3</mediaTitle>
<mediaDate>2008-11-16</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081116_sun_dvk_0930.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081116_sun_dvk_0930_5k.flv</mediaVideoFile>
<mediaTitle>Elemental - Three Kinds of Righteousness</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081116_sun_dvk_1700.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081116_sun_dvk_1700_5k.flv</mediaVideoFile>
<mediaTitle>Two Different Lessons from Two Different Generations</mediaTitle>
<mediaDate>2008-11-12</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081112_wed_jf_1900.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081112_wed_jf_1900_5k.flv</mediaVideoFile>
<mediaTitle>Mylon LeFevre</mediaTitle>
<mediaDate>2008-11-02</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081102_sun_ml_1700.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081102_sun_ml_1700_5k.flv</mediaVideoFile>
<mediaTitle>The Pursuit of Joy Pt2 - The Oil of Joy</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081102_sun_dvk_0930.mp3</mediaAudioFile>
<mediaVideoFile>http://pri-cdn.reslife.org/reslifechurch/ondemand/maincampus/2008/20081102_sun_dvk_0930_5k.flv</mediaVideoFile>
<mediaTitle>Catch the Chazown</mediaTitle>
<mediaDate>2008-10-29</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081029_wed_ts_1900.mp3</mediaAudioFile>
<mediaTitle>Pastor Daniel Vander Klok</mediaTitle>
<mediaDate>2008-10-26</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081026_sun_davk_0930.mp3</mediaAudioFile>
<mediaTitle>Pastor Brent Matzen</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081026_sun_bm_1700.mp3</mediaAudioFile>
<mediaTitle>Pastor Ken Reynolds</mediaTitle>
<mediaDate>2008-10-22</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081022_wed_kr_1900.mp3</mediaAudioFile>
<mediaTitle>The Pursuit of Joy</mediaTitle>
<mediaDate>2008-10-19</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081019_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>Pastor Dorie Meendering</mediaTitle>
<mediaDate>2008-10-15</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081015_wed_dm_1900.mp3</mediaAudioFile>
<mediaTitle>Elemental Pt3</mediaTitle>
<mediaDate>2008-10-12</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081012_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>John the Methodist Pt2</mediaTitle>
<mediaDate>2008-10-05</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081005_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>Elemental Pt2</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081005_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>Pastor Bernie Blauwkamp</mediaTitle>
<mediaDate>2008-10-01</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20081001_wed_bb_1900.mp3</mediaAudioFile>
<mediaTitle>Rick Renner</mediaTitle>
<mediaDate>2008-09-28</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080928_sun_rr_0930.mp3</mediaAudioFile>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080928_sun_rr_1700.mp3</mediaAudioFile>
<mediaTitle>Pastor Tim Ostrom</mediaTitle>
<mediaDate>2008-09-24</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080924_wed_to_1900.mp3</mediaAudioFile>
<mediaTitle>John the Methodist</mediaTitle>
<mediaDate>2008-09-21</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080921_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>Elemental</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080921_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>Jimmy Evens-PM</mediaTitle>
<mediaDate>2008-09-14</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080914_sun_je_1700.mp3</mediaAudioFile>
<mediaTitle>Jimmy Evens-AM</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080914_sun_je_0930.mp3</mediaAudioFile>
<mediaTitle>Spiritual Warfare Pt11 - Doctrines of Devils Pt3</mediaTitle>
<mediaDate>2008-09-07</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080907_sun_dvk_0930.mp3</mediaAudioFile>
<mediaDate>2008-08-27</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080827_wed_cc_1900.mp3</mediaAudioFile>
<mediaTitle>Pastor Samuel Vander Klok</mediaTitle>
<mediaDate>2008-08-24</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080824_sun_svk_1700.mp3</mediaAudioFile>
<mediaTitle>Keeping a Good Attitude</mediaTitle>
<mediaDate>2008-08-17</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080817_sun_jt_1700.mp3</mediaAudioFile>
<mediaTitle>Jason Frank</mediaTitle>
<mediaDate>2008-08-06</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080806_wed_jf_1900.mp3</mediaAudioFile>
<mediaTitle>Van Crouch</mediaTitle>
<mediaDate>2008-08-03</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080803_sun_vc_1700.mp3</mediaAudioFile>
<mediaTitle>Pastor Joe Tucker</mediaTitle>
<mediaDate>2008-07-30</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080730_wed_jt_1900.mp3</mediaAudioFile>
<mediaDate>2008-07-23</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080723_wed_jt_1900.mp3</mediaAudioFile>
<mediaTitle>Pastor Todd Staal</mediaTitle>
<mediaDate>2008-07-16</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080716_wed_ts_1900.mp3</mediaAudioFile>
<mediaTitle>5pm - Pastor Joe Tucker</mediaTitle>
<mediaDate>2008-07-13</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080713_sun_jt_1700.mp3</mediaAudioFile>
<mediaTitle>7pm - Living a Victorious Life Pt2</mediaTitle>
<mediaDate>2008-07-09</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080709_wed_kr_1900.mp3</mediaAudioFile>
<mediaTitle>5pm - Your True Identity</mediaTitle>
<mediaDate>2008-07-06</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080706_sun_bb_1700.mp3</mediaAudioFile>
<mediaTitle>9:30am - Spiritual Warfare Pt4</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080706_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>7pm - Living a Victorious Life</mediaTitle>
<mediaDate>2008-07-02</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080702_wed_kr_1900.mp3</mediaAudioFile>
<mediaTitle>11:30am - Spiritual Warfare Pt3</mediaTitle>
<mediaDate>2008-06-29</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080629_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>9:30am - Spiritual Warfare</mediaTitle>
<mediaDate>2008-06-22</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080622_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>11:30am - Spiritual Warfare</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080622_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>5pm - Spiritual Warfare Pt2</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080622_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>5pm - Bishop Darrell Hines</mediaTitle>
<mediaDate>2008-06-08</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080608_sun_bdh_1700.mp3</mediaAudioFile>
<mediaTitle>11:30am - Bishop Darrell Hines</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080608_sun_bdh_1130.mp3</mediaAudioFile>
<mediaTitle>7pm - Brother Abraham</mediaTitle>
<mediaDate>2008-06-04</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080604_wed_ba_1900.mp3</mediaAudioFile>
<mediaTitle>11:30am - Let the Redeemed Say So! Theology of the Maltese</mediaTitle>
<mediaDate>2008-06-01</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080601_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>5pm - Pastor Brent Matzen</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080601_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>9:30am - Let the Redeemed Say So! Theology of the Maltese</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080601_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>7pm - Pastor Bernie Blauwkamp</mediaTitle>
<mediaDate>2008-05-28</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080528_wed_bb_1900.mp3</mediaAudioFile>
<mediaTitle>5pm - Renewing your mind part 3</mediaTitle>
<mediaDate>2008-05-18</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080518_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>9:30am - Day of Adversity</mediaTitle>
<mediaDate>2008-05-04</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080504_sun__dvk_0930.mp3</mediaAudioFile>
<mediaTitle>11:30am - Day of Adversity</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080504_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>5:00pm - Day of Adversity Pt2</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080504_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>5pm - Samuel Vander Klok</mediaTitle>
<mediaDate>2008-04-27</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080427_sun_svk_1700.mp3</mediaAudioFile>
<mediaTitle>11:30 - Trusting God in Every Area of our Life</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080427_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>9:30am - Trusting God in Every Area of our Life</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080427_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>9:30am - The Good Samaritan</mediaTitle>
<mediaDate>2008-04-20</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080420_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>11:30am - The Good Samaritan</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080420_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>5pm - The Joseph Testimony Pt2</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080420_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>7pm - Tim Ostrom</mediaTitle>
<mediaDate>2008-04-16</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080416_wed_to_1900.mp3</mediaAudioFile>
<mediaTitle>7pm - Perry Stone</mediaTitle>
<mediaDate>2008-04-14</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080414_mon_ps_1900.mp3</mediaAudioFile>
<mediaTitle>5pm - Perry Stone</mediaTitle>
<mediaDate>2008-04-13</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080413_sun_ps_1700.mp3</mediaAudioFile>
<mediaTitle>11:30am - Perry Stone</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080413_sun_ps_1130.mp3</mediaAudioFile>
<mediaTitle>9:30am - Perry Stone</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080413_sun_ps_0930.mp3</mediaAudioFile>
<mediaTitle>6pm - Perry Stone</mediaTitle>
<mediaDate>2008-04-12</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080412_sat_ps_1800.mp3</mediaAudioFile>
<mediaTitle>7pm - Joe Tucker</mediaTitle>
<mediaDate>2008-04-09</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080409_wed_jt_1900.mp3</mediaAudioFile>
<mediaTitle>5pm - The Joseph Testimony</mediaTitle>
<mediaDate>2008-04-06</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080406_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>11:30am - What is the Purpose of the Church</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080406_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>9:30am - What is the Purpose of the Church</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080406_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>7pm - Pastor Joe Tucker</mediaTitle>
<mediaDate>2008-04-02</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080402_wed__jt_1900.mp3</mediaAudioFile>
<mediaTitle>7pm - Pastor Bernie Blawkamp</mediaTitle>
<mediaDate>2008-03-26</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080326_wed_bb_1900.mp3</mediaAudioFile>
<mediaTitle>7pm - Jonah Pt2</mediaTitle>
<mediaDate>2008-03-19</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080319_wed_cclem_1900.mp3</mediaAudioFile>
<mediaTitle>9:30am - Thoughts on the Fall-Palm Sunday</mediaTitle>
<mediaDate>2008-03-16</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080316_sun_dvk_0930.mp3</mediaAudioFile>
<mediaTitle>5pm- Thoughts on the Fall-Palm Sunday Pt2</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080316_sun_dvk_1700.mp3</mediaAudioFile>
<mediaTitle>11:30am - Thoughts on the Fall-Palm Sunday</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080316_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>7:00pm - Blake McDaniel</mediaTitle>
<mediaDate>2008-03-05</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080305_wed_bmd_1900.mp3</mediaAudioFile>
<mediaTitle>5:00pm - Are you who you want to be</mediaTitle>
<mediaDate>2008-03-02</mediaDate>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080302_sun_eg_1700.mp3</mediaAudioFile>
<mediaTitle>11:30 - Secret of the Very Blessed</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080302_sun_dvk_1130.mp3</mediaAudioFile>
<mediaTitle>09:30 - Secret of the Very Blessed</mediaTitle>
<mediaAudioFile>http://pri-cdn.reslife.org/reslifechurch/web/maincampus/2008/audio/20080302_sun_dvk_0930.mp3</mediaAudioFile>
</availableMedia>
Code:
using System;
using System.Net;
using System.Data;
using System.IO;
using System.Configuration;
using System.Xml;
using System.Globalization;
public partial class videolist : System.Web.UI.Page
{
protected void Page_Load(object s, EventArgs e)
XmlDocument xmldoc, xmlResDoc;
xmldoc = new XmlDocument();
XmlElement RootElem, statElem;
xmlResDoc = new XmlDocument();
RootElem = xmlResDoc.CreateElement("xmlRequest");
RootElem.SetAttribute("type","adminMediaList");
RootElem.SetAttribute("access",ConfigurationSettings.AppSettings["AccessKey"]);
xmlResDoc.AppendChild(RootElem);
string strUname, strPwd, strOutput, strStatus,strURL;
strUname = ConfigurationManager.AppSettings["APIResUserName"];
strURL = ConfigurationManager.AppSettings["APIResURL"];
CreateErroLog("URL",strURL);
strPwd = ConfigurationManager.AppSettings["APIKEY"];
strOutput = ConfigurationManager.AppSettings["APIoutput"];
CreateErroLog("String",strURL+"?api_key="+strPwd+"&user="+strUname);
string strStatus2=GetPage(strURL+"?api_key="+strPwd+"&user="+strUname);
CreateErroLog("api_token="+ strStatus2);
if(strStatus2 !="")
CreateErroLog("http://ext.reslife.org/api/index.php?api_token="+strStatus2+"&ministry=1&category=20");
xmldoc.Load("http://ext.reslife.org/api/index.php?api_token="+strStatus2+"&ministry=1&category=20");
strStatus =xmldoc.GetElementsByTagName("availableMedia")[0].InnerText;
//Response.Write(strStatus);
CreateErroLog("strStatus : " + strStatus);
if(strStatus != "" )
CreateErroLog("Inside if condition : " );
int iNodecount=0;
string strId, strPath, strTitle, strAuthor, strDesc, strRes, strSize, strEmbed;
string strAudioSample, strFps, strDuration, strDate;
XmlNodeList objxmlNodeList = xmldoc.SelectNodes("availableMedia/mediaItem");
XmlElement mediaElem, idElem, pathElem, titleElem, authorElem, descElem, resElem;
XmlElement sizeElem, embedElem, audioSampleElem, fpsElem, durationElem, dateElem, timeElem;
statElem = xmlResDoc.CreateElement("status");
statElem.InnerText = "0";
RootElem.AppendChild(statElem);
foreach(XmlNode xNode in objxmlNodeList)
mediaElem = xmlResDoc.CreateElement("mediaData");
RootElem.AppendChild(mediaElem);
//strId = xNode.SelectNodes("id").Item(0).InnerText;
idElem = xmlResDoc.CreateElement("mediaId");
idElem.InnerText = "";//strId;
mediaElem.AppendChild(idElem);
strPath = xNode.SelectNodes("mediaVideoFile").Item(0).InnerText;
pathElem = xmlResDoc.CreateElement("filePath");
CreateErroLog("strStatus : " + strPath);
pathElem.InnerText = strPath;
mediaElem.AppendChild(pathElem);
strTitle = xNode.SelectNodes("mediaTitle").Item(0).InnerText;
titleElem = xmlResDoc.CreateElement("title");
titleElem.InnerText = strTitle;
mediaElem.AppendChild(titleElem);
//strAuthor = xNode.SelectNodes("author").Item(0).InnerText;
authorElem = xmlResDoc.CreateElement("author");
authorElem.InnerText = "";//strAuthor;
mediaElem.AppendChild(authorElem);
//strDesc = xNode.SelectNodes("description").Item(0).InnerText;
descElem = xmlResDoc.CreateElement("description");
descElem.InnerText = "";//strDesc;
mediaElem.AppendChild(descElem);
//strRes = xNode.SelectNodes("res").Item(0).InnerText;
resElem = xmlResDoc.CreateElement("res");
resElem.InnerText = "";//strRes;
mediaElem.AppendChild(resElem);
//strSize = xNode.SelectNodes("size").Item(0).InnerText;
sizeElem = xmlResDoc.CreateElement("size");
sizeElem.InnerText = "";//strSize;
mediaElem.AppendChild(sizeElem);
//strAudioSample = xNode.SelectNodes("mediaAudioFile").Item(0).InnerText;
audioSampleElem = xmlResDoc.CreateElement("audiosample");
audioSampleElem.InnerText = "";
mediaElem.AppendChild(audioSampleElem);
//strFps = xNode.SelectNodes("fps").Item(0).InnerText;
fpsElem = xmlResDoc.CreateElement("fps");
fpsElem.InnerText = "";//strFps;
mediaElem.AppendChild(fpsElem);
//strEmbed = xNode.SelectNodes("embed").Item(0).ChildNodes.Item(1).InnerXml;
embedElem = xmlResDoc.CreateElement("EmbedCode");
embedElem.InnerText = "";//strEmbed;
mediaElem.AppendChild(embedElem);
//strDuration = xNode.SelectNodes("duration").Item(0).InnerText;
durationElem = xmlResDoc.CreateElement("duration");
durationElem.InnerText = "";//strDuration;
mediaElem.AppendChild(durationElem);
strDate = xNode.SelectNodes("mediaDate").Item(0).InnerText;
DateTime dt = Convert.ToDateTime(strDate);
dateElem = xmlResDoc.CreateElement("updatedDate");
dateElem.InnerText = dt.ToShortDateString().ToString();
mediaElem.AppendChild(dateElem);
timeElem = xmlResDoc.CreateElement("updatedTime");
timeElem.InnerText = dt.ToShortTimeString().ToString();
mediaElem.AppendChild(timeElem);
//CreateErroLog("strStatus : " + mediaElem);
Response.Write("dfdf"+mediaElem+"<br/>");
//RootElem = Response.Write("dfdf"+strId+"<br/>");
}
else
statElem.InnerText = "1";
CreateErroLog("statElem.InnerText : ");
xmlResDoc.Save(Response.OutputStream);
public void CreateErroLog(string ErrorType, string ErrorMessage)
string ErrorLogFolderName = "C:/inetpub/wwwroot/reslife/ErrorLog";
string ErrorLogFileName = ErrorLogFolderName + "/error.txt";
if (!Directory.Exists(ErrorLogFolderName))
Directory.CreateDirectory(ErrorLogFolderName);
StreamWriter sw = new StreamWriter(ErrorLogFileName, true);
sw.WriteLine("/******************" + ErrorType + "****************//*");
sw.WriteLine(ErrorMessage);
sw.Close();
sw.Dispose();
public void CreateErroLog(string ErrorMessage)
public string GetPage(String url)
WebResponse response = null;
StreamReader reader = null;
try
WebClient wc = new WebClient();
string apiTokenStr="";
string apiTokenValue="";
byte[] response1 = wc.DownloadData(url);
WebHeaderCollection whc = wc.ResponseHeaders;
CreateErroLog("header count = {0} "+whc.Count);
for (int i = 0; i < whc.Count; i++)
apiTokenStr=whc.GetKey(i);
if(apiTokenStr == "X-RLC-API-TOKEN")
apiTokenValue=whc.Get(i);
break;
CreateErroLog(apiTokenStr + " = " +apiTokenValue);
// string str = wc.DownloadString("http://ext.reslife.org/api/index.php?api_token="+apiTokenValue+"&ministry=1&category=69");
//CreateErroLog("hello : " +str);
return apiTokenValue;
// string str = wc.DownloadString(url);
// CreateErroLog("hello : " +str);
//WebRequest request = WebRequest.Create(url);
//response = request.GetResponse();
//Stream responseStream = response.GetResponseStream();
//reader = new StreamReader(responseStream);
//CreateErroLog("\r\nResponse stream received");
// Char[] buffer = new Char[256];
//int count = reader.Read(buffer, 0, buffer.Length);
//CreateErroLog("HTML...\r\n");
//while (count > 0)
// {
// CreateErroLog(new String(buffer, 0, count));
// count = reader.Read(buffer, 0, buffer.Length);
// }
//CreateErroLog("");
catch (UriFormatException)
CreateErroLog("\r\nThe request URI was malformed.");
catch (WebException)
CreateErroLog("\r\nThe request URI could not be found.");
catch (IOException)
CreateErroLog("\r\nThe request URI could not be retrieved.");
finally
if (response != null)
response.Close();
if (reader != null)
reader.Close();
return "";