Skip to content

Instantly share code, notes, and snippets.

View yannduran's full-sized avatar

Yann Duran yannduran

View GitHub Profile
@yannduran
yannduran / AuthorizeRedirect.cs
Created September 27, 2015 13:33 — forked from bjcull/AuthorizeRedirect.cs
Authorize attribute that redirects to view if you're logged in but don't have permission
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class AuthorizeRedirect : AuthorizeAttribute
{
public string RedirectUrl = "~/Error/Unauthorized";
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
base.HandleUnauthorizedRequest(filterContext);
if (filterContext.RequestContext.HttpContext.User.Identity.IsAuthenticated)
<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabsStudio:Tab}">
<Grid>
<Border Name="Border" BorderBrush="#609ABA" BorderThickness="1,1,1,0" CornerRadius="3,3,0,0">
<ContentPresenter ContentSource="Header" Margin="12,2,12,2"/>
</Border>
</Grid>
<ControlTemplate.Triggers>