小编Maj*_*ani的帖子

Asmx Web服务基本认证

我想在我的asmx Web服务中使用用户名和密码验证来实现基本身份验证.
我不想使用WCF,我知道这不是安全的方式,但我需要使用基本身份验证而不使用https.

我的网络服务是这样的:

[WebService(Namespace = "http://www.mywebsite.com/")]
public class Service1
{
    [WebMethod]
    public string HelloWorld()
    {
        return "Hello world";
    }
}
Run Code Online (Sandbox Code Playgroud)

我使用这个自定义HttpModule:

public class BasicAuthHttpModule : IHttpModule
{
    void IHttpModule.Init(HttpApplication context)
    {
        context.AuthenticateRequest += new EventHandler(OnAuthenticateRequest);
    }

    void OnAuthenticateRequest(object sender, EventArgs e)
    {
        string header = HttpContext.Current.Request.Headers["Authorization"];

        if (header != null && header.StartsWith("Basic"))  //if has header
        {
            string encodedUserPass = header.Substring(6).Trim();  //remove the "Basic"
            Encoding encoding = Encoding.GetEncoding("iso-8859-1");
            string userPass = encoding.GetString(Convert.FromBase64String(encodedUserPass));
            string[] credentials = userPass.Split(':');
            string username …
Run Code Online (Sandbox Code Playgroud)

web-services asmx basic-authentication

14
推荐指数
1
解决办法
4万
查看次数

实体框架6 - 启用迁移时不创建表

在我的应用程序中,我通过一些迁移启用了Code First Migrations,我还使用SQL Server Compact进行集成测试.

当我运行我的测试时,Entity Framework会创建一个空数据库并尝试在该空数据库上运行迁移并抛出 The specified table does not exist.

基于报告,我认为实体框架6中迁移的使用已发生变化.

我测试了所有数据库初始化程序,Context.Database.Create();但在所有情况下都没有创建tabale.

entity-framework ef-migrations entity-framework-6.1

6
推荐指数
1
解决办法
6401
查看次数

在VCL中禁用DbGrids.pas中键盘布局的自动更改

我使用ActivateKeyboardLayout(HKL_NEXT, KLF_ACTIVATE);Delphi XE2来加载波斯语键盘布局,但有时我点击TextBox或DbGrid控件键盘会自动更改为英文布局.

如何禁用键盘布局的自动更改?

delphi keyboard-layout delphi-xe2

5
推荐指数
1
解决办法
1851
查看次数

delphi的数据访问框架

在基于分层架构的Delphi中是否有用于数据访问的框架或代码生成器?

delphi code-generation data-access-layer

3
推荐指数
1
解决办法
1513
查看次数