我已經爲使用FubuMVC的Web應用程序實現了CurrentUserPropertyBinder(請參見下文)。與CurrentUserPropertyBinder相關的問題它不能始終記住用戶
public class CurrentUserPropertyBinder : IPropertyBinder
{
private readonly Database _database;
private readonly ISecurityContext _security;
public CurrentUserPropertyBinder(Database database, ISecurityContext security)
{
_database = database;
_security = security;
}
public bool Matches(PropertyInfo property)
{
return property.PropertyType == typeof(User)
&& property.Name == "CurrentUser";
}
public void Bind(PropertyInfo property, IBindingContext context)
{
var currentUser = //check database passing the username to get further user details using _security.CurrentIdentity.Name
property.SetValue(context.Object, currentUser, null);
}
}
當我登錄到我的網站時,這工作正常。該CurrentUserPropertyBinder擁有所有它需要執行的任務的信息(即_security.CurrentIdentity.Name中有正確的用戶詳細信息)
當我嘗試並使用fineUploader導入文件(http://fineuploader.com/)打開其中標準fileDialog _security.CurrentIdentity.Name爲空。
它似乎沒有記得誰是用戶,我不知道爲什麼。它適用於我所有的其他路線,但後來我導入一個文件,它不會記住用戶。
請幫忙!由於提前
注意:我們正在使用FubuMVC.Authentication到
您是否使用FubuMVC.Authentication或其他方法來驗證您的用戶? – ventaur
我們使用FubuMVC.Authentication來驗證用戶 –