Javascript System.NullReferenceException:对象引用未设置为对象的实例。Dotnetnuke模块创建

Javascript System.NullReferenceException:对象引用未设置为对象的实例。Dotnetnuke模块创建,javascript,html,asp.net,dotnetnuke,Javascript,Html,Asp.net,Dotnetnuke,我在asp.net中有一个脚本,该脚本从上一页获取产品名称,如下所示: <% strProductID = Convert.ToString(Request.QueryString("ProductID")) strLinkPath = "\DNN7\PRODUCTPDF\" + strProductID + ".pdf" %> 另外,如果我将要打印的动态链接放在标签中,我会得到与我手动设置的路径相同的路径,并且与此相同:“\DNN7\PRODUCTPDF\1.pd

我在asp.net中有一个脚本,该脚本从上一页获取产品名称,如下所示:

<%
    strProductID = Convert.ToString(Request.QueryString("ProductID"))
    strLinkPath = "\DNN7\PRODUCTPDF\" + strProductID + ".pdf"
%>
另外,如果我将要打印的动态链接放在标签中,我会得到与我手动设置的路径相同的路径,并且与此相同:
“\DNN7\PRODUCTPDF\1.pdf”
,但是动态链接不起作用,我会不断收到此错误

我做错了什么

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& completedSynchronously) +164

我删除了runat=server并将路径更改为此strLinkPath=“/DNN7/PRODUCTPDF/”+strProductID+“.pdf”,当此错误总是发生时,它对我有效,因为SQLSERVER实例服务未启动或需要重新启动 解决此问题的步骤: -打开SQLServerManagementStudio。 -尝试连接到sql实例。 -右键单击实例->停止,然后重新开始。 或 -在windows服务上搜索您的实例SQL Server(实例名称) -右键单击停止,然后单击开始 刷新你的页面它应该可以工作
希望此帮助

单击链接时出现错误?是否在DOM上为元素生成了开关代码?是,单击链接时出现错误。你的意思是:?我认为错误在生成的href中。我不知道这对我有什么帮助。我尝试了这篇文章中的一些组合,但我只被重定向到同一个页面,并且没有任何东西可以从元素中删除
runat='server'
strLinkPath = "\DNN7\PRODUCTPDF\1.pdf"
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& completedSynchronously) +164