title: How would I redirect a null reference from this code to a different page
body: <p>I am brand new to c# and am currently modifying code. This is the code that I have:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      checkMember("Challenge", "answerQuestion.gif");
  
      var pagenameTemp = Session["RequestedPage"].ToString();
      var pagename = pagenameTemp.Substring(0, pagenameTemp.IndexOf('.'));
      var node = Settings.getNode("Challenge/HighRisk");
  </code></pre>
  
  <p>I want to be able to redirect the null reference that I'm getting on:</p>
  
  <pre><code>var pagenameTemp = Session["RequestedPage"].ToString();
  </code></pre>
  
  <p>to a new page. I've tried different if statements and have yet to be successful.</p>