本文整理汇总了C#中Castle.MonoRail.Framework.Controller类的典型用法代码示例。如果您正苦于以下问题:C# Controller类的具体用法?C# Controller怎么用?C# Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Controller类属于Castle.MonoRail.Framework命名空间,在下文中一共展示了Controller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterDynamicActions
public void RegisterDynamicActions(Controller controller)
{
foreach (IPresentationViewHandler handler in presentationTypesToViewHandlers.Values)
{
handler.RegisterDynamicActions(controller);
}
}
示例2: GetControllerName
private string GetControllerName(Controller c)
{
string controllerName = c.Name;
if (!String.IsNullOrEmpty(c.AreaName))
controllerName = c.AreaName + "/" + controllerName;
return controllerName;
}
示例3: AddRelatedAction
public static IAction AddRelatedAction(string description, Controller c, string action, params string[] queryString)
{
IDictionary parameters = null;
if (queryString != null && queryString.Length > 0)
parameters = dictHelper.CreateDict(queryString);
return AddRelatedAction(description, c.AreaName, c.Name, action, parameters);
}
示例4: CreateView
public AspViewBase CreateView(Type type, TextWriter output, IRailsEngineContext context, Controller controller)
{
ConstructorInfo constructor = (ConstructorInfo)constructors[type];
AspViewBase self = (AspViewBase)FormatterServices.GetUninitializedObject(type);
constructor.Invoke(self, new object[] { this, output, context, controller });
return self;
}
示例5: Perform
/// <summary>
/// Executa o filtro.
/// </summary>
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (!Enabled)
return true;
UserAgent ua = null;
var uaString = context.UnderlyingContext.Request.UserAgent;
if (uaString != null)
{
ua = (UserAgent) cache[uaString];
if (ua == null)
cache[uaString] = ua = new UserAgent(uaString);
}
if (IsValid(ua))
return true;
if (!logged)
{
Log.Error("Tentativa de acesso através de browser não suportado: {0}", uaString);
logged = true;
}
controller.PropertyBag["invalidGecko"] = true;
if (!Redirect)
return true;
throw new Exception("redir: " + Redirect);
//RedirectToNotice(controller);
//return false;
}
示例6: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
// Read previous authenticated principal from session
// (could be from cookie although with more work)
User user = (User) context.Session["user"];
// Sets the principal as the current user
context.CurrentUser = user;
// Checks if it is OK
if (context.CurrentUser == null || !context.CurrentUser.Identity.IsAuthenticated)
{
// Not authenticated, redirect to login
NameValueCollection parameters = new NameValueCollection();
parameters.Add("ReturnUrl", context.Url);
controller.Redirect("login", "index", parameters);
// Prevent request from continue
return false;
}
// Everything is ok
return true;
}
示例7: GetBooPaths
protected virtual string[] GetBooPaths(Controller controller, string[] myBoos){
var paths = new List<string>();
foreach (var s in myBoos){
paths.Add(controller.Context.Server.MapPath("~/views/report/" + s + ".boo"));
}
return paths.ToArray();
}
示例8: BrailBase
/// <summary>
/// Initializes a new instance of the <see cref="BrailBase"/> class.
/// </summary>
/// <param name="viewEngine">The view engine.</param>
/// <param name="output">The output.</param>
/// <param name="context">The context.</param>
/// <param name="__controller">The controller.</param>
public BrailBase(BooViewEngine viewEngine, TextWriter output, IRailsEngineContext context, Controller __controller)
{
this.viewEngine = viewEngine;
this.outputStream = output;
this.context = context;
this.__controller = __controller;
InitProperties(context, __controller);
}
示例9: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext ctx, Controller c)
{
if (!controllersToSkip.IsMatch(GetControllerName(c)))
if (ctx.CurrentUser == null || !ctx.CurrentUser.Identity.IsAuthenticated)
return TryAutoLogin();
return true;
}
示例10: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Request.Headers["mybadheader"] != null)
{
context.Response.Write("Denied!");
return false;
}
return true;
}
示例11: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (context.Params["printable"] != null)
{
controller.LayoutName = "printabletheme";
}
return true;
}
示例12: BuildContent
public INode BuildContent(IReportControllerExtension extension, Controller controller){
var content = Stub.Create();
SetValue("content", content);
Extension = extension;
Extension.CustomContentPreparatorPrepare(this);
CustomPrepare();
processBrail(controller);
return content;
}
示例13: GetCurrentLang
public static string GetCurrentLang(Controller controller)
{
string lang = controller.Request.ReadCookie(Constants.LOCALE_COOKIE);
if ((lang == null) || (lang.Length == 0))
{
lang = controller.Request.UserLanguages[0].Substring(0,2);
}
return lang;
}
示例14: Perform
public bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
User user = (User)context.Session["logonUser"];
if (user == null)
{
return false;
}
return true;
}
示例15: Perform
public virtual bool Perform(ExecuteEnum exec, IRailsEngineContext context, Controller controller)
{
if (!PerformAuthentication(context))
{
context.Response.Redirect("account", "authentication");
return false;
}
return true;
}