Good day folks...
This may seem like an odd question and I apologize in advance for the limited information to work with in this case but I'll do what I can to give the needed info...
My website http://www.bariby-quance.com has a journal/blog component that I built within it that, on all of the computers in my household and in 3 different browsers (Firefox, IE and Safari) has never once encountered an error.
However, I have had a couple of people tell me they are receiving errors when using the asp.net apps I've built into my site and I can't replicate them. I spoke with technical support at my hosting provider but they don't have server-side error logs they can provide me on their windows server platform. The tech support agent did, however, hit an error after literally hundreds of clicks on the post navigation buttons in my journal as follows:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Unfortunately, not having had debug mode active on the page at the time I wasn't able to get more details on the error cause (and as I said I haven't been able to replicate it).
The navigation buttons on my page are simple and the code is as follows:
protected void newestButton_Click(object sender, EventArgs e)
{
Response.Redirect("blogged.aspx?post=" + highestPost.ToString());
}
protected void oldestButton_Click(object sender, EventArgs e)
{
Response.Redirect("blogged.aspx?post=" + lowestPost.ToString());
}
protected void fwdButton_Click(object sender, EventArgs e)
{
Response.Redirect("blogged.aspx?post=" + nextPost.ToString());
}
protected void backButton_Click(object sender, EventArgs e)
{
Response.Redirect("blogged.aspx?post=" + prevPost.ToString());
}
The post ranges used are generated by:
private void navButtonSetup()
{
//initialize navigation button visibility
string connStr = @loadConn.cString;
SqlConnection loadMsgConn = new SqlConnection(@connStr);
SqlDataAdapter loadMsgAdapt = new SqlDataAdapter(@"SELECT mID FROM blMessages WHERE isDeleted = 'False'", loadMsgConn);
SqlCommandBuilder loadMsgBuilder = new SqlCommandBuilder(loadMsgAdapt);
DataSet loadMsgSet = new DataSet();
loadMsgAdapt.Fill(loadMsgSet, "origMsg");
loadMsgConn.Close();
if (loadMsgSet.Tables["origMsg"].Rows.Count > 0) //Determine if table contains more than 0 listings
{
for (int i = 0; i < loadMsgSet.Tables["origMsg"].Rows.Count; i++) //cycle through list of replies to determine lowest/highest reply IDs and list all of them
{
DataRow respRow = loadMsgSet.Tables["origMsg"].Rows[i];
string resID = respRow["mID"].ToString();
msgIDList += resID.ToString();
if (i < loadMsgSet.Tables["origMsg"].Rows.Count - 1)
{
msgIDList += ",";
}
}
}
string[] listedString = msgIDList.Split(','); //split list into component parts
int[] listedIDs = new int[listedString.Length];
for (int i = 0; i < listedString.Length; i++)
{
listedIDs[i] = Convert.ToInt16(listedString[i]);
}
lowestPost = listedIDs[0]; //determine lowest replyID in list
highestPost = listedIDs[listedIDs.Length - 1]; //determine highest replyID in list
for (int a = 0; a < listedIDs.Length; a++) //cycle through list to determine "next" and "previous" replyIDs for navigation
{
if (listedIDs[a] == origNum)
{
if (a - 1 >= 0)
{
prevPost = listedIDs[a - 1];
}
else
{
prevPost = listedIDs[a];
}
if (a + 1 <= listedIDs.Length - 1)
{
nextPost = listedIDs[a + 1];
}
else
{
nextPost = listedIDs[a];
}
}
}
I've included a zip of the .aspx and .aspx.cs files relevant to this scenario as I don't think anyone wants me to post the entire code here and it's possible that the error is generated by another segment other than just the navigation buttons.
As I said, if I could replicate it I'd have more information for you but unfortunately you now have as much info as I do and I'm hoping someone might be able to help figure this out :)