我想在我的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) 在我的应用程序中,我通过一些迁移启用了Code First Migrations,我还使用SQL Server Compact进行集成测试.
当我运行我的测试时,Entity Framework会创建一个空数据库并尝试在该空数据库上运行迁移并抛出 The specified table does not exist.
基于此报告,我认为实体框架6中迁移的使用已发生变化.
我测试了所有数据库初始化程序,Context.Database.Create();但在所有情况下都没有创建tabale.
我使用ActivateKeyboardLayout(HKL_NEXT, KLF_ACTIVATE);Delphi XE2来加载波斯语键盘布局,但有时我点击TextBox或DbGrid控件键盘会自动更改为英文布局.
如何禁用键盘布局的自动更改?
在基于分层架构的Delphi中是否有用于数据访问的框架或代码生成器?