web服务  有很多函数 提供结果在这些函数中  都有相同或者类似的  验证部分 也保证使用者有身份 或者 权限 获得结果这样就会有大量重复性的查询,如果都查询数据库 是不是会有行能问题 【我的服务器不怎么样】这样的需求你们一般怎么做?我现在的做法是  维护一个登录列表  
登录时候添加  登出时候删除  中间过程  都查询这里列表 

解决方案 »

  1.   

    放在session里。asp.net有解决方案,参考:Explained: Forms Authentication in ASP.NET 2.0
    http://msdn.microsoft.com/en-us/library/ff647070.aspx
      

  2.   

    这是上面文章里的流程:
    1. The user requests the Default.aspx file from your application's virtual directory. IIS allows the request because anonymous access is enabled in the IIS metabase. ASP.NET confirms that theauthorization element includes a <deny users="?" /> tag.
    2. The server looks for an authentication cookie. If it fails to find the authentication cookie, the user is redirected to the configured logon page (Login.aspx), as specified by the LoginUrl attribute of the forms element. The user supplies and submits credentials through this form. Information about the originating page is placed in the query string using RETURNURL as the key. The server HTTP reply is as follows:
    3. 302 Found Location: 
    4. http://localhost/FormsAuthTest/login.aspx?RETURNURL=%2fFormAuthTest%2fDefault.aspx
      
    5. The browser requests the Login.aspx page and includes the RETURNURL parameter in the query string.
    6. The server returns the logon page and the 200 OK HTTP status code.
    7. The user enters credentials on the logon page and posts the page, including the RETURNURL parameter from the query string, back to the server.
    8. The server validates user credentials against a store, such as a SQL Server database or an Active Directory user store. Code in the logon page creates a cookie that contains a forms authentication ticket that is set for the session.
    In ASP.NET 2.0, the validation of user credentials can be performed by the membership system. The Membership class provides the ValidateUser method for this purpose as shown here:
    if (Membership.ValidateUser(userName.Text, password.Text))
    {
        if (Request.QueryString["ReturnUrl"] != null)
        {
            FormsAuthentication.RedirectFromLoginPage(userName.Text, false);
        }
        else
        {
            FormsAuthentication.SetAuthCookie(userName.Text, false);
        }
    }
    else
    {
        Response.Write("Invalid UserID and Password");
    }
      
    Note   When using the Login Web server control, it automatically performs the following steps for you. The preceding code is provided for context.
    9. For the authenticated user, the server redirects the browser to the original URL that was specified in the query string by the RETURNURL parameter. The server HTTP reply is as follows:
    10. 302 Found Location: 
    11. http://localhost/TestSample/default.aspx
      
    12. Following the redirection, the browser requests the Default.aspx page again. This request includes the forms authentication cookie.
    13. The FormsAuthenticationModule class detects the forms authentication cookie and authenticates the user. After successful authentication, the FormsAuthenticationModule class populates the current User property, which is exposed by the HttpContext object, with information about the authenticated user.
    14. Since the server has verified the authentication cookie, it grants access and returns the Default.aspx page.
      

  3.   

    另外  我估计你这个  是继承了 win验证  或者  集成验证而我那个  不是身份验证  是有没有使用权的验证不好形容啊
      

  4.   

    Forms,还是windows验证,可以配置的,你自己也可以实现自己的Provider.
      

  5.   

    简单的就是通过你自己喜欢的类型,存储在Session中,例如Session[key]=object
    需要更新是再重新查询存到Session中
      

  6.   

    你们提到用  Session我现在是 web服务  我用的是  public shared 效果差不多吧
      

  7.   

    那个新表里都存储了什么东西?用户名、权限之类的啊?你登录的时候把用户信息存放在session里,再插入你的新表里,推出的时候再删除不就行了吗!
      

  8.   


    你这个就是我的做法啊不过我用的是 public shared   user as list而不是 Session因为我这个是web服务 不是 页面啊