Uri - System.NullReferenceException - HELP!
-
Hello crowd. I'm having some serious issues with my coding.. Can anybody please take a look at this and tell me what's wrong?? Thanks... First of all, the C# code-behind file that's causing my headaches: [code] using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace tracker { /// /// Summary description for adtracker. /// public class adtracker : System.Web.UI.Page { String strReferrer = ""; protected System.Web.UI.WebControls.Label labelMessage; private void Page_Load(object sender, System.EventArgs e) { Uri uriReferrer = Request.UrlReferrer; strReferrer = uriReferrer.ToString(); labelMessage.Text = strReferrer; } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } } [/code] And the HTML/ASPX display file, which doesn't really matter, but I'm including it for reference anyways. It just contains my Label (labelMessage) which I'm using for debugging purposes. [code] <%@ Page language="c#" Codebehind="adtracker.aspx.cs" AutoEventWireup="false" Inherits="tracker.adtracker" %> adtracker
Label
[/code] Now - I'm constantly getting a System.NullReferenceException on this line: [code] strRefe