Click here to Skip to main content
15,892,005 members
Articles / Security

Manage security and redirection for non authorized access in MVC

Rate me:
Please Sign up or sign in to vote.
4.50/5 (7 votes)
18 Jul 2012CPOL2 min read 56.5K   1.4K   26  
How to apply security and redirection to a view when a user cannot access a controller or a controller action in MVC
namespace MvcSecurityApplication.Tools.SqlCeMembership
{
    internal class Sr
    {
        internal const string ProviderApplicationNameTooLong = "The application name is too long.";
        internal const string ProviderBadPasswordFormat = "Password format specified is invalid.";
        internal const string ProviderCanNotRetrieveHashedPassword = "Configured settings are invalid: Hashed passwords cannot be retrieved. Either set the password format to different type, or set supportsPasswordRetrieval to false.";
        internal const string ProviderError = "The Provider encountered an unknown error.";
        internal const string ProviderNotFound = "Provider '{0}' was not found.";
        internal const string ProviderRoleAlreadyExists = "The role '{0}' already exists.";
        internal const string ProviderRoleNotFound = "The role '{0}' was not found.";
        internal const string ProviderSchemaVersionNotMatch = "The '{0}' requires a database schema compatible with schema version '{1}'.  However, the current database schema is not compatible with this version.  You may need to either install a compatible schema with aspnet_regsql.exe (available in the framework installation directory), or upgrade the provider to a newer version.";
        internal const string ProviderThisUserAlreadyInRole = "The user '{0}' is already in role '{1}'.";
        internal const string ProviderThisUserNotFound = "The user '{0}' was not found.";
        internal const string ProviderUnknownFailure = "Stored procedure call failed.";
        internal const string ProviderUnrecognizedAttribute = "Attribute not recognized '{0}'";
        internal const string ProviderUserNotFound = "The user was not found in the database.";
        internal const string ParameterArrayEmpty = "The array parameter '{0}' should not be empty.";
        internal const string ParameterCanNotBeEmpty = "The parameter '{0}' must not be empty.";
        internal const string ParameterCanNotContainComma = "The parameter '{0}' must not contain commas.";
        internal const string ParameterDuplicateArrayElement = "The array '{0}' should not contain duplicate values.";
        internal const string ParameterTooLong = "The parameter '{0}' is too long: it must not exceed {1} chars in length.";
        internal const string PageIndexPageSizeBad = "The combination of pageIndex and pageSize cannot exceed the maximum value of System.Int32.";
        internal const string PageSizeBad = "The pageSize must be greater than zero.";
        internal const string PageIndexBad = "The pageIndex must be greater than or equal to zero.";

        internal static string GetString(string strString)
        {
            return strString;
        }

        internal static string GetString(string strString, string param1)
        {
            return string.Format(strString, param1);
        }

        internal static string GetString(string strString, string param1, string param2)
        {
            return string.Format(strString, param1, param2);
        }

        internal static string GetString(string strString, string param1, string param2, string param3)
        {
            return string.Format(strString, param1, param2, param3);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect CGI
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions