System.NullReferenceException:对象引用未设置为对象的实例.Dotnetnuke模块创建
System.NullReferenceException: Object reference not set to an instance of an object. Dotnetnuke module creation
我在asp.net中有一个脚本,它从上一页获取产品名称,我得到的是这样的:
<%
strProductID = Convert.ToString(Request.QueryString("ProductID"))
strLinkPath = "'DNN7'PRODUCTPDF'" + strProductID + ".pdf"
%>
并且u将该id指定为pdf名称,这是相同的。我尝试从这个链接标签下载这个pdf:
<a runat="server" class="pdfLink" href="<% =strLinkPath %>"><% =strLinkPath %></a>
我得到错误'System.NullReferenceException: Object reference not set to an instance of an object. '
如果我将路径直接添加到标签,它会很好地工作:
strLinkPath = "'DNN7'PRODUCTPDF'1.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=服务器,并将路径更改为此strLinkPath="/DNN7/PRODUCTPDF/"+strProductID+".pdf",它在上运行
对于我来说,发生此错误总是因为SQLSERVER实例服务未启动或需要重新启动解决此问题的步骤:-打开sqlserver管理工作室。-尝试连接到sql实例。-右键单击实例->停止,然后重新启动。或-在windows服务上搜索您的实例SQL Server(实例名称)-右键单击"停止",然后启动刷新你的页面,它应该可以工作希望这能帮助
相关文章:
- ES6构造函数返回基类的实例
- KnockoutJS-组件-多个实例
- 为什么无法在TypeScript中导出类实例
- 如何在GoogleWeb工具包(GWT)中从JSNI调用接口(实例化)
- fluxxor向一个flux实例添加一组以上的操作
- 使用jQuery获取Dropzone实例/对象
- "实例范围”;TypeScript类的getter/setter
- 如何在速度模板中获取LiferayPortlet实例id
- 同一项怎么可能在一个实例中未定义,却在另一个实例上定义
- 实例创建(JS)
- 显示模块模式在Knockout中设置模型的新实例
- 如何获取单选按钮的多个实例的选定单选按钮值
- 当同一浏览器的两个实例浏览时,Javascript页面如何具有唯一的ID
- 在哪里可以找到RXUI Javascript'时间飞逝'实例
- spine.js在启动时填充模型实例
- 不再需要时使用jQuery/kill实例
- 如何在用户输入时实例化数组
- 从Sequelize中的非实例更新
- 如何基于数组值创建新实例
- System.NullReferenceException:对象引用未设置为对象的实例.Dotnetnuke模块创建