我记得有一种方法可以让<input type="password" />
浏览器不会提示用户保存密码.但我画了一个空白.是否有HTML属性或一些JavaScript技巧可以做到这一点?
我想基于一个简单的标准更新一组行,并获取已更改的PK列表.我以为我可以做这样的事情,但我担心可能的并发问题:
SELECT Id FROM Table1 WHERE AlertDate IS NULL;
UPDATE Table1 SET AlertDate = getutcdate() WHERE AlertDate IS NULL;
Run Code Online (Sandbox Code Playgroud)
如果包含在事务中,是否存在可能发生的并发问题?或者有更好的方法吗?
当机器人使用HEAD攻击我的ASP.NET MVC站点时,我想正确支持HTTP HEAD请求.我注意到,对网站的所有HTTP HEAD请求都返回404,特别是来自http://downforeveryoneorjustme.com.哪个真烦人.希望他们像其他所有好机器人一样切换到GET.
如果我只是[AcceptVerbs(HttpVerbs.Get)]
改为[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Head)]
将MVC知道放弃请求的正文?
你做了什么来支持HTTP HEAD请求?(代码示例会很棒!)
我个人厌恶网站上的背景音乐.我的客户对这个问题有不同的看法.我添加音乐是因为客户永远是对的,尽管我想用它们重新审视这个主题.
几乎每个人都会同意它很烦人并浪费宝贵的带宽,但是有没有可用性研究或推荐专业人士可以提供有效的背景音乐论据?
查看为ASP.NET MVC2编写的http://lukesampson.com/post/471548689/entering-and-exiting-https-with-asp-net-mvc中的示例代码,我注意到他们可以检查自定义属性是否为通过访问filterContext.ActionDescriptor
和filterContext.ActionDescriptor.ControllerDescriptor
分别应用于当前操作或控制器:
public class ExitHttpsIfNotRequiredAttribute : FilterAttribute, IAuthorizationFilter {
public void OnAuthorization(AuthorizationContext filterContext) {
// snip
// abort if a [RequireHttps] attribute is applied to controller or action
if(filterContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes(typeof(RequireHttpsAttribute), true).Length > 0) return;
if(filterContext.ActionDescriptor.GetCustomAttributes(typeof(RequireHttpsAttribute), true).Length > 0) return;
// snip
}
}
Run Code Online (Sandbox Code Playgroud)
检查自定义属性的操作和控制器的ASP.NET MVC 1方法是什么?在ASP.NET MVC 1中filterContext.ActionDescriptor
,我无法分辨.
我看了一遍,找不到答案.我在ASP.NET MVC4中设置了一个简单的测试控制器,如下所示:
public class TestController {
[HttpGet]
public ActionResult Index() {
MyModel model = new MyModel();
model.Debug += "GET Method";
return View(model);
}
[HttpPost]
public ActionResult Post(MyModel model) {
model.Debug += "POST Method";
return View("Index", model);
}
}
Run Code Online (Sandbox Code Playgroud)
索引视图只有一个表单和一个POST到/ Test/Post的按钮,它应该只返回带有Index
视图的HTTP 200 .这在我的笔记本电脑和我的服务器上按预期工作.但是在托管服务提供商上,当我执行POST时,我得到以下信息:
POST /Test/Post returns HTTP 302 Redirect to /Test/Post (What the heck?)
GET /Test/Post returns HTTP 404
Run Code Online (Sandbox Code Playgroud)
怎么可能发生这种情况?有什么想法解决这个问题?
我所知道的环境之间的唯一区别是我安装了.NET 4.5并且安装了.NET 4.0(并且由于某种原因不会安装4.5.)这些项目目标是.NET 4,所以不要认为这很重要吗?最初我让他们的目标是4.5,但在我得知它没有安装在服务器上后改变了它.
搜索返回302的ASP.NET POST会引发很多关于由于登录而导致重定向的问题.但是此控制器不受任何类型的受限文件夹或[Authorize]
属性限制.
无论有没有尝试过<authorization>
,无论是哪种结果都是如此.这是system.web,以防这有用:
<system.web>
<customErrors mode="Off"/> …
Run Code Online (Sandbox Code Playgroud) 我有期望几个属性由Ninject 2被注入的方法属性,但userSession
并jobRepository
都上来为空:
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class JobAttribute : ActionFilterAttribute {
[Inject]
private IUserSession userSession;
[Inject]
private IJobRepository jobRepository;
public override void OnActionExecuting(ActionExecutingContext filterContext) {
var filter = new JobFilter(userSession, jobRepository);
filter.OnActionExecuting(filterContext);
}
}
Run Code Online (Sandbox Code Playgroud)
这是控制器中的方法:
[AcceptGet, Job]
public ActionResult Dimensions(Job job) {
return View(job.Building);
}
Run Code Online (Sandbox Code Playgroud)
我知道我的设置有效,因为如果我在控制器上使用构造函数注入,则会注入控制器的参数.虽然需要使用属性注入,但这对属性没有多大帮助.我在这里错过了什么吗?
以下是Global.asax.cs的相关部分:
public class MvcApplication : Ninject.Web.Mvc.NinjectHttpApplication {
protected override void OnApplicationStarted() {
RegisterRoutes(RouteTable.Routes);
RegisterAllControllersIn(Assembly.GetExecutingAssembly());
}
...snip...
protected override IKernel CreateKernel() {
return new StandardKernel(
new RepositoryConfiguration(),
new AuthenticationModule(),
new …
Run Code Online (Sandbox Code Playgroud) c# asp.net-mvc ninject property-injection actionfilterattribute
您如何在SQL中表示时间多对多关系?在非时间环境下,人们会使用连接表(也就是链接/桥/地图)来连接双方.
添加时间跟踪就像在联结表上包含ValidStart和ValidEnd列一样简单吗?如果你这样做了,你遇到了什么问题(如果有的话)?在这种关系中,是否有更好的方法来跟踪随时间的变化?
如果它有帮助,在我的情况下,我专门使用SQL 2008,时间数据不是双时态的,因为我只跟踪有效时间.
sql database-design temporal-database temporal sql-server-2008
我们开始使用Scrum流程进行开发.我们现在有很多用户故事.我想知道,一旦用户故事完成,经过测试和部署,你还可以用它做任何其他事情吗?我们现在正在使用小索引卡,我认为将它们扔进垃圾桶会很好.
如果你保留它们,你以后会怎么做?
asp.net-mvc ×3
c# ×2
sql ×2
acceptverbs ×1
agile ×1
asp.net ×1
automation ×1
html ×1
http-head ×1
http-post ×1
ninject ×1
passwords ×1
scrum ×1
selenium ×1
sql-server ×1
t-sql ×1
temporal ×1
usability ×1
user-stories ×1
watin ×1
web ×1