主题:  asp.net基于窗体的身份验证问题?

zhutu

职务:普通成员
等级:1
金币:0.0
发贴:4
#12003/11/20 23:27:28
我在自己的机子测试成功了,但上传服务器为什么会出现如下:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
错误呢?

文件夹外面的web.config文件:
<configuration>
<system.web>
<compilation debug="true"/>
<customErrors mode="Off"/>
</system.web>
</configuration>

login.aspx文件:
<%@ Import Namespace="System.Web.Security " %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<Html>
<Body>
<Form runat="server">

请先登入您的帐号及密码:


<Blockquote>

帐号:<asp:TextBox runat="server" id="Account" />

密码:<asp:TextBox runat="server" id="Password"
TextMode="Password" />

记住密码:<asp:CheckBox runat="server" id="RememberMe" />


<asp:Button runat="server" text="登入" onClick="Login_Click" />

<asp:Label runat="server" id="Msg" ForeColor="Red" />

</Blockquote>

<Font Size=-1 Color=Blue>登入网页前, 请确定浏览器的 Cookie 是开启的.</Font>
</Form>
</Body>
</Html>

<script language="VB" runat="server">

Sub Login_Click( sender As Object, e As EventArgs )

If Verify( Account.Text, Password.Text ) Then
FormsAuthentication.RedirectFromLoginPage(Account.Text, RememberMe.Checked)
Else
Msg.Text = "帐号或密码错误, 请重新输入!"
End If
End Sub

Function Verify( 帐号 As String, 密码 As String) As Boolean
Dim Conn As OleDbConnection, Cmd As OleDbCommand
Dim Rd As OleDbDataReader, SQL As String

Dim Provider = "Provider=Microsoft.Jet.OLEDB.4.0"
Dim Database = "Data Source=" & Server.MapPath( "Users.mdb" )
Conn = New OleDbConnection( Provider & ";" & DataBase )
Conn.Open()

SQL = "Select * From Users Where " & _
"UserID='" & 帐号 & "'" & _
" And Password='" & 密码 & "'"
Cmd = New OleDbCommand( SQL, Conn )
Rd = Cmd.ExecuteReader()
If Rd.Read() Then ' 表示有找到 UserID 及 Password, 通过验证
Conn.Close()
Return True
Else
Conn.Close()
Msg.Text = "帐号或密码错误, 请重新输入!"
Return False
End If
End Function
</script>

web.comfig文件:
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="manage" loginUrl="Login.aspx" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>



zhutu

职务:普通成员
等级:1
金币:0.0
发贴:4
#22003/11/21 18:09:38
??什么意思啊。
上面login.aspx我打错了,我是大写的Login.aspx

在自己机子什么问题都没有,但上传就不能运行了。
估计可能是web.config配置有问题,但改了几次,还是没解决~



咖啡无味

职务:普通成员
等级:1
金币:0.0
发贴:135
#32003/11/29 14:19:16
空间的权限和你本机的一样吗!



zhutujiji

职务:普通成员
等级:1
金币:0.0
发贴:6
#42003/11/30 11:41:39
不是,我只有上传ftp权限。我在本机是要在2000的管理工具---internet服务管理器设置一下才行。可能上传后认不出来了?
是不是要管理员帮我设置一下2000服务器?