我在GitHub中有一个"超级"存储库,它将包含我想要部署到Heroku的几个应用程序.这是我的存储库的一个例子.
/app
/.git
/website <-- would like to deploy this to Heroku
Run Code Online (Sandbox Code Playgroud)
当我尝试使用以下命令推送时:
$ git push heroku master
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Heroku push rejected, no Rails or Rack app detected.
Run Code Online (Sandbox Code Playgroud)
如何将子目录部署到Heroku?
我很难在具有自定义主体的MVC应用程序中实现"记住我"功能.我把它归结为ASP.NET而不是为我检索身份验证cookie.我在Google Chrome中添加了一张快照.
显示在控制器操作中设置并放置在ViewData中以供视图读取的Request.Cookies的结果.请注意,它缺少.ASPXAUTH cookie
显示Chrome开发人员工具的结果.你可以看到.ASPXAUTH包含在这里.
替代文字http://i50.tinypic.com/ibctjd.png
这可能是什么问题?为什么ASP.NET不从cookie集合中读取此值?
我的应用程序使用自定义IPrincipal.BusinessPrincipalBase是一个CSLA对象,它实现了IPrincipal.这是代码:
[Serializable()]
public class MoralePrincipal : BusinessPrincipalBase
{
private User _user;
public User User
{
get
{
return _user;
}
}
private MoralePrincipal(IIdentity identity) : base(identity)
{
if (identity is User)
{
_user = (User)identity;
}
}
public override bool Equals(object obj)
{
MoralePrincipal principal = obj as MoralePrincipal;
if (principal != null)
{
if (principal.Identity is User && this.Identity is User)
{
return ((User)principal.Identity).Equals(((User)this.Identity));
}
}
return base.Equals(obj);
}
public override int …
Run Code Online (Sandbox Code Playgroud) 我正在使用Grape gem为我的应用程序创建API.一切都运行良好,直到我将http基本身份验证添加到我的api中,该api内置于Grape api中.
这是我的代码:
require 'grape'
module MyApp
class API < Grape::API
prefix 'api'
version 'v1'
helpers do
def current_user
@current_user ||= User.authenticate(env)
end
def authenticate!
error!('401 Unauthorized', 401) unless current_user
end
end
resources :projects do
http_basic do |u,p|
authenticate! #=> Results in undefined method `authenticate!' for MyApp::API:Class (NoMethodError)
error! "401 Unauthorized", 401
!current_user.nil?
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
似乎我无法访问http_basic块中的任何方法或对象,包括请求,env,帮助器方法中的任何内容,甚至没有错误!
看一下代码,这没有意义.
有没有人遇到过这个?有没有人有任何使用带有http基本身份验证的Grape API的例子?网络上的例子不是现实世界的例子.
我在ASP.NET MVC(v1)中有一个表单,它有2个输入按钮.每个提交按钮必须包含在这个单一的表单中,我需要知道用户按下了哪一个.
我知道检查FormCollection值的技巧,它将根据按下的按钮返回.例如,如果我有和用户单击Button2,我应该可以说Request.Form ["Button2"]!= null并且将评估为true,在这种情况下,我知道用户单击了该按钮.
但是,这对我不起作用.我的所有按钮的值都为null,因为它们中的不包含在Request.Form值中.ASP.NET MVC中是否存在吞下这些值的错误?
这是我的表单代码:
<% using (Html.BeginForm()) {%>
<% Html.RenderPartial( "EditAreaControl", Model ); %>
<div class="form-layout-command-container">
<div class="form-layout-command-area-alpha"><button type="submit" name="submit1" value="Save">Save</button></div>
<div class="form-layout-command-area-alpha"><button type="submit" name="submit2" value="SaveAndCopy">Save and Create Copy</button></div>
<div class="form-layout-command-area-beta"><%= Html.ActionLink("Cancel", "list") %></div>
</div>
<% } %>
Run Code Online (Sandbox Code Playgroud)
这是我的控制器代码:
[AcceptVerbs( HttpVerbs.Post )]
public ActionResult Add(FormCollection values )
{
if (values["submit1"] != null)
// always false
if (values["submit2"] != null)
// always false as well
}
Run Code Online (Sandbox Code Playgroud)