VS2010 SQL2008 IIS6LOGIN.ASHXusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Security.Cryptography;
using System.Data.SqlClient;
using System.Web.SessionState;
namespace BRS.Ashx
{
    /// <summary>
    /// Login 的摘要说明
    /// </summary>
    public class Login : IHttpHandler, IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("TRUE");//测试
            string id = context.Request["BRS_id"].ToString();//取用户输入的用户名
            string password = FormsAuthentication.HashPasswordForStoringInConfigFile(context.Request["BRS_password"].ToString(), "MD5");//取用户输入的密码并加密
            SqlDataReader dr = SQLHelper.ExecuteReader("SELECT lock FROM users WHERE id = '" + id + "'");//注释掉这里是可以正常返回TRUE的
..
...下面代码没有贴全。
在VS2010直接F5调试,是可以正常通过的,ashx能正常返回值。
通过IIS访问就不行了,包括127.0.0.1,192.168.18.100(本机局域网IP),但我试了一下,把上面操作数据库的语句注释掉,在IIS下也可以正常返回值,所以我认为是数据库操作的问题,但是为什么调试的时候没有问题呢?请大神帮忙。

解决方案 »

  1.   

    就是普通的aspx没有特别设置过
      

  2.   


    写了个小程序提示用户 '0A9D087B82B34BF\ASPNET' 登录失败。 我的连接串是    <add name="connStr" connectionString="Data Source=0A9D087B82B34BF\SQLEXPRESS;Initial Catalog=BRS;Integrated Security=True"/>
      

  3.   


    写了个小程序提示用户 '0A9D087B82B34BF\ASPNET' 登录失败。 我的连接串是    <add name="connStr" connectionString="Data Source=0A9D087B82B34BF\SQLEXPRESS;Initial Catalog=BRS;Integrated Security=True"/>数据源是什么?sqlserver?access?
      

  4.   


    写了个小程序提示用户 '0A9D087B82B34BF\ASPNET' 登录失败。 我的连接串是    <add name="connStr" connectionString="Data Source=0A9D087B82B34BF\SQLEXPRESS;Initial Catalog=BRS;Integrated Security=True"/>数据源是什么?sqlserver?access?sql
      

  5.   

    <add name="connStr" connectionString="Data Source=ip;Initial Catalog=数据库名;Persist Security Info=True;User ID=sa;Password=密码" />-->