session问题 我用localhost的时候,当session失效时,会自动跳转到登陆页面,这个是正常的,当用IP地址访问的时候,就会出现“为将对象引用设置到对象的实例”,到底是什么原因啊,能帮忙解决下吗 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 估计你在Web.config文件中,将地址写死成localhost了,贴出你的Web.Config文件来看一下。 <?xml version="1.0"?><!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --><configuration> <connectionStrings> <add name="hqglDatabaseStr" connectionString="data source=localhost;Initial Catalog=sd;User ID=sa;Password=801226" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0"/> <sessionState mode ="StateServer" cookieless="true" timeout="20"/> <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2"/> </authentication> <membership> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> </providers> </membership> <profile> <providers> <clear/> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> </providers> </profile> <roleManager enabled="false"> <providers> <clear/> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/> </providers> </roleManager> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer></configuration> <?xml version="1.0"?><!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --><configuration> <connectionStrings> <add name="hqglDatabaseStr" connectionString="data source=localhost;Initial Catalog=sd;User ID=sa;Password=801226" providerName="System.Data.SqlClient"/> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0"/> <sessionState mode="InProc" cookieless="true" timeout="20"/> <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2"/> </authentication> <membership> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> </providers> </membership> <profile> <providers> <clear/> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> </providers> </profile> <roleManager enabled="false"> <providers> <clear/> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/> </providers> </roleManager> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer></configuration> 在你的另外一个帖子里已经回答过了,你可以试一试:http://topic.csdn.net/u/20110921/16/7a1fdf0e-f98b-44cf-8d25-409ce74743bc.html?seed=1886894976&r=75642625#r_75642625另外在web.config中添加 <customErrors defaultRedirect="Login.aspx" mode="On"/>,页面有错误时会自动跳转到首页。 是否程序中未判断Session[""] 是否为null if(session[""]==null){跳转到登陆页面} 页面保存为utf-8和ASNI有什么区别吗 asp.net能开发哪些东西? 按一个按钮如何在textBox的(假如已经有很多文字,并且光标不在文字末尾)光标闪烁处插入一段文字? 求助:研究过淘宝客api的朋友进来看一下吧 一条高难度的sql语句 关于用户控件的继承 问个老问题:限定repeater列宽的显示字数后,怎么使鼠标停在上面时把所有的内容显示出来 关于ViewState得疑问 紧急请教高手,急用啊 定义用户控件问题 请教.net网站程序域名授权问题 强行删除正在使用的图片报错 ??
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="hqglDatabaseStr" connectionString="data source=localhost;Initial Catalog=sd;User ID=sa;Password=801226" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<sessionState mode ="StateServer" cookieless="true" timeout="20"/>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="hqglDatabaseStr" connectionString="data source=localhost;Initial Catalog=sd;User ID=sa;Password=801226" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<sessionState mode="InProc" cookieless="true" timeout="20"/>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
另外在web.config中添加 <customErrors defaultRedirect="Login.aspx" mode="On"/>,页面有错误时会自动跳转到首页。
跳转到登陆页面
}