I am working On asp.net2.0(c#)
In creating rss i used a user control by writing xml dynamically.
It is working well in my personal server but in my client server it is producing error such that..
Server Error in '/GetReception' Application.
The remote server returned an error: (500) Internal Server Error.
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.Net.WebException: The remote server returned an error: (500) Internal Server Error.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[WebException: The remote server returned an error: (500) Internal Server Error.]
System.Net.HttpWebRequest.GetResponse() +1529755
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +61
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +1865280
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +51
System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +44
System.Threading.CompressedStack.runTryCode(Object userData) +54
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0
System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) +174
System.Xml.XmlTextReaderImpl.OpenUrl() +199
System.Xml.XmlTextReaderImpl.Read() +50
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +145
System.Xml.XmlDocument.Load(XmlReader reader) +96
System.Xml.XmlDataDocument.Load(XmlReader reader) +190
System.Xml.XmlDocument.Load(String filename) +157
System.Xml.XmlDataDocument.Load(String filename) +17
GetReception.UI.Controls.RssReader.DoBinding() +118
GetReception.UI.Controls.RssReader.Page_Load(Object sender, EventArgs e) +5
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
|
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
I am used the user control :RssReader.ascx
<%
@ Control Language="C#" AutoEventWireup="true" CodeFile="RssReader.ascx.cs" Inherits="GetReception.UI.Controls.RssReader" %><div class="sectiontitle">
<
asp:HyperLink ID="lnkRss" runat="server" ToolTip="Get the RSS for this content"><asp:Image runat="server" ID="imgRss" ImageUrl="~/Images/rss.gif" AlternateText="Get RSS feed" />
</
asp:HyperLink>
<
asp:Literal runat="server" ID="lblTitle"/> </div>
<
asp:DataList id="dlstRss" Runat="server" EnableViewState="False">
<ItemTemplate>
<small><%# Eval("PubDate", "{0:d}") %></small>
<br>
<div class="sectionsubtitle"><asp:HyperLink Runat="server" ID="lnkTitle"
NavigateUrl='<%# Eval("Link") %>' Text='<%# Eval("Title") %>' /></div><%# Eval("Description") %>
</ItemTemplate></asp:DataList>
<
p style="text-align: right;"><small><asp:HyperLink Runat="server" ID="lnkMore" /></small></p>
In RssReader.cs
public partial class RssReader : BaseWebPart
{
public RssReader()
{
this.Title = "RSS Reader";
}
[WebBrowsable,
WebDisplayName("Rss Url"),WebDescription("The Url of the RSS feed")]public string RssUrl
{
get { return lnkRss.NavigateUrl; }set { lnkRss.NavigateUrl = value; }
}
[WebBrowsable,
WebDisplayName("Header Text"),WebDescription("The header's text")]public string HeaderText
{
get { return lblTitle.Text; }set { lblTitle.Text = value; }
}
[WebBrowsable,
WebDisplayName("Number of columns"),WebDescription("The grid's number of columns")]public int RepeatColumns
{
get { return dlstRss.RepeatColumns; }set { dlstRss.RepeatColumns = value; }
}
[WebBrowsable,
WebDisplayName("More Url"),WebDescription("The Url of the link pointing to more content")]public string MoreUrl
{
get { return lnkMore.NavigateUrl; }set { lnkMore.NavigateUrl = value; }
}
[WebBrowsable,
WebDisplayName("More Text"),WebDescription("The text of the link pointing to more content")]public string MoreText
{
get { return lnkMore.Text; }set { lnkMore.Text = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
DoBinding();
}
protected void Page_PreRender(object sender, EventArgs e)
{
DoBinding();
}
protected void DoBinding()
{
//try
//{if (this.RssUrl.Length == 0)
throw new ApplicationException("The RssUrl cannot be null.");
// create a DataTable and fill it with the RSS data,
// then bind it to the Repeater controlXmlDataDocument feed = new XmlDataDocument();
string s = GetFullUrl(this.RssUrl);feed.Load(GetFullUrl(this.RssUrl));
XmlNodeList posts = feed.GetElementsByTagName("item");
DataTable table = new DataTable("Feed");table.Columns.Add("Title", typeof(string));
table.Columns.Add(
"Description", typeof(string));table.Columns.Add("Link", typeof(string));
table.Columns.Add(
"PubDate", typeof(DateTime));foreach (XmlNode post in posts)
{
DataRow row = table.NewRow();
row[
"Title"] = post["title"].InnerText;row["Description"] = post["description"].InnerText.Trim();
row[
"Link"] = post["link"].InnerText;row["PubDate"] = DateTime.Parse(post["pubDate"].InnerText);
table.Rows.Add(row);
}
dlstRss.DataSource = table;
dlstRss.DataBind();
//}
//catch (Exception ex)
//{
// string s = ex.Message;
// //this.Visible = false;
//}
}
private string GetFullUrl(string url)
{
if (url.StartsWith("/") || url.StartsWith("~/"))
{
string ur = this.Request.ApplicationPath;if (ur.EndsWith("/"))
url = ur + url;
elseurl = ur + "/" + url;
url = url.Replace(
"~/", "");url= this.Request.Url.AbsoluteUri.Replace(this.Request.Url.PathAndQuery, "") + url;
}
return url;
}
}
How ian get aroun that problem.Please reply me.
Thanks for early reply.
anjan kumar maity