title: System.NullReferenceException: Object reference not set to an instance of an object. Dotnetnuke module creation
body: <p>I have in asp.net a script that gets a product name from the previous page and i get it like this :</p>
  
  <pre><code>&lt;%
      strProductID = Convert.ToString(Request.QueryString("ProductID"))
      strLinkPath = "\DNN7\PRODUCTPDF\" + strProductID + ".pdf"
  %&gt;
  </code></pre>
  
  <p>and u assign that id as the pdf name, which is the same. 
  I try to download this pdf from this link label:</p>
  
  <pre><code>&lt;a runat="server" class="pdfLink" href="&lt;% =strLinkPath %&gt;"&gt;&lt;% =strLinkPath %&gt;&lt;/a&gt;
  </code></pre>
  
  <p>and i get the error <code>'System.NullReferenceException: Object reference not set to an instance of an object. '</code></p>
  
  <p>If i add the path straight to the label it works fine :</p>
  
  <pre><code>strLinkPath = "\DNN7\PRODUCTPDF\1.pdf"
  </code></pre>
  
  <p>Also if i put the dynamic link to be printed in the label i get the same path as the one i setup manually and its the same as this:<code>"\DNN7\PRODUCTPDF\1.pdf"</code>  but the dynamic doesnt work and i keep getting this error. </p>
  
  <p>What am i doing wrong here?</p>
  
  <pre><code>Server Error in '/DNN7' 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: 
  
  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: 
  
  
  [NullReferenceException: Object reference not set to an instance of an object.]
     DotNetNuke.Entities.Urls.AdvancedUrlRewriter.Handle404OrException(FriendlyUrlSettings settings, HttpContext context, Exception ex, UrlAction result, Boolean transfer, Boolean showDebug) +165
     DotNetNuke.Entities.Urls.AdvancedUrlRewriter.RewriteUrl(Object sender, EventArgs e) +867
     System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +91
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +164
  </code></pre>