Click here to Skip to main content
15,884,099 members
Articles / Security

Create Custom Permission in Object Level

Rate me:
Please Sign up or sign in to vote.
4.94/5 (12 votes)
11 Jun 2012CPOL3 min read 56.4K   3.8K   35  
Custom permission in object level with out sign in and out to affect to users
  • CustomPermission.zip
    • CustomPermission
      • _ReSharper.CustomPermission
        • AspFileDataCache.dat
        • BuildScriptCache
          • .crc
          • .version
          • 3
          • 4
          • 7
            • 1bf95fc0.dat
          • 8
        • CompletionStatistics
          • Statistics.dat
        • ConditionalNames
          • .crc
          • .version
          • 3
            • 6c372d4a.dat
        • JavaScriptCache
          • .crc
          • .version
          • 1
            • 17ec39db.dat
          • 4
            • 7c982103.dat
          • 6
        • JbDecompilerCache
        • JbPdbInfo
          • 430b456cc4cc0aad0ce0e397a7233eb9dcf4a4c2
        • JSTest
          • .crc
          • .version
        • ModuleIds.xml
        • MVC
          • .crc
          • .version
        • NamedArguments
          • .crc
          • .version
          • 3
            • 6c372d4a.dat
        • PersistenIdIndex.bin
        • RecentItems
          • RecentFiles.dat
        • Resources
          • .crc
          • .version
        • SymbolCache.bin
        • TagPrefixes
          • .crc
          • .version
          • 2
          • 4
          • 7
            • 3f005da6.dat
        • TodoItems
          • .crc
          • .version
          • 4
            • 7c982103.dat
        • WebSymbols
          • .crc
          • .version
          • 2
          • 7
            • 3f005da6.dat
        • WordIndex
          • .crc
          • .version
          • 3
            • 6c372d4a.dat
        • XmlIndex
          • Accessibility.xml
            • 88C087D2.bin
          • Microsoft.Build.Framework.4.0.0.0.Nullness.Generated.xml
            • 94363C24.bin
          • Microsoft.Build.Framework.xml
            • B1211D02.bin
          • Microsoft.Build.Tasks.v4.0.4.0.0.0.Nullness.Generated.xml
            • CCCC0FE4.bin
          • Microsoft.Build.Tasks.v4.0.xml
            • D0D97272.bin
          • Microsoft.Build.Utilities.v4.0.4.0.0.0.Nullness.Generated.xml
            • E27CE424.bin
          • Microsoft.Build.Utilities.v4.0.xml
            • F257AC8A.bin
          • Microsoft.CSharp.4.0.0.0.Nullness.Generated.xml
            • 47A918C4.bin
          • Microsoft.CSharp.xml
            • 52F85A1D.bin
          • Microsoft.JScript.10.0.0.0.Nullness.Generated.xml
            • 20590911.bin
          • Microsoft.JScript.xml
            • 6BD458A3.bin
          • Microsoft.Transactions.Bridge.4.0.0.0.Nullness.Generated.xml
            • 6FC0CFA4.bin
          • Microsoft.VisualBasic.10.0.0.0.Contracts.xml
            • 0DBBB121.bin
          • Microsoft.VisualBasic.10.0.0.0.Nullness.Generated.xml
            • 40E599D1.bin
          • Microsoft.VisualBasic.10.0.0.0.Pure.xml
            • F2E62CD2.bin
          • Microsoft.VisualBasic.Activities.Compiler.10.0.0.0.Nullness.Generated.xml
            • 091234D1.bin
          • Microsoft.VisualBasic.xml
            • 5EAC1448.bin
          • Microsoft.VisualC.xml
            • F652E411.bin
          • Microsoft.Web.Infrastructure.xml
            • A633D4EC.bin
          • mscorlib.4.0.0.0.Contracts.xml
            • BA0B7454.bin
          • mscorlib.4.0.0.0.Interfaces.Nullness.Generated.xml
            • E943BD5C.bin
          • mscorlib.4.0.0.0.Nullness.Generated.xml
            • D37F1B04.bin
          • mscorlib.4.0.0.0.Pure.xml
            • 0C16D8C7.bin
          • mscorlib.I18n.xml
            • 0AA1DA3F.bin
          • mscorlib.Nullness.Manual.xml
            • A44AFA55.bin
          • mscorlib.ValueFlow.xml
            • D2DAC228.bin
          • mscorlib.xml
            • 48F8C2BF.bin
            • 8B5A35BB.bin
          • SMDiagnostics.4.0.0.0.Nullness.Generated.xml
            • C77EB924.bin
          • System.4.0.0.0.Contracts.xml
            • 07845DD4.bin
          • System.4.0.0.0.Nullness.Generated.xml
            • 6B56B484.bin
          • System.4.0.0.0.Pure.xml
            • DE77D247.bin
          • System.Activities.4.0.0.0.Nullness.Generated.xml
            • F8F15EE4.bin
          • System.Activities.DurableInstancing.4.0.0.0.Nullness.Generated.xml
            • 27FB04A4.bin
          • System.Activities.DurableInstancing.xml
            • C1942077.bin
          • System.Activities.xml
            • 538BA89C.bin
          • System.ComponentModel.DataAnnotations.4.0.0.0.Nullness.Generated.xml
            • 547533E4.bin
          • System.ComponentModel.DataAnnotations.I18n.xml
            • E15B095F.bin
          • System.ComponentModel.DataAnnotations.xml
            • 5F93661D.bin
          • System.Configuration.4.0.0.0.Contracts.xml
            • FB4CED54.bin
          • System.Configuration.4.0.0.0.Nullness.Generated.xml
            • 0C78B404.bin
          • System.Configuration.4.0.0.0.Pure.xml
            • 7748B1C7.bin
          • System.Configuration.Install.4.0.0.0.Contracts.xml
            • 86EDEE74.bin
          • System.Configuration.Install.4.0.0.0.Nullness.Generated.xml
            • 44FAAA64.bin
          • System.Configuration.Install.xml
            • 4197A788.bin
          • System.Configuration.xml
            • 879C8D27.bin
          • System.Core.4.0.0.0.Contracts.xml
            • 0B7C8174.bin
          • System.Core.4.0.0.0.Nullness.Generated.xml
            • DA9E9D64.bin
          • System.Core.4.0.0.0.Pure.xml
            • 717C2A67.bin
          • System.Core.LinqTunnel.xml
            • D9B819C3.bin
          • System.Core.Nullness.Manual.xml
            • 693BFE35.bin
          • System.Core.xml
            • F613CD2C.bin
          • System.Data.4.0.0.0.Contracts.xml
            • 6B3912F4.bin
          • System.Data.4.0.0.0.Nullness.Generated.xml
            • AF56DEE4.bin
          • System.Data.4.0.0.0.Pure.xml
            • CB37CBE7.bin
          • System.Data.DataSetExtensions.4.0.0.0.Nullness.Generated.xml
            • E2D9EC64.bin
          • System.Data.DataSetExtensions.I18n.xml
            • FA1E61DF.bin
          • System.Data.DataSetExtensions.xml
            • F93DB151.bin
          • System.Data.Entity.4.0.0.0.Nullness.Generated.xml
            • CAA94524.bin
          • System.Data.Entity.xml
            • 31BB3492.bin
          • System.Data.I18n.xml
            • 4BA2745F.bin
          • System.Data.Linq.4.0.0.0.Nullness.Generated.xml
            • 90DB83C4.bin
          • System.Data.Linq.Attributes.xml
            • 50E54BDE.bin
          • System.Data.Linq.I18n.xml
            • 8338C47F.bin
          • System.Data.Linq.xml
            • 3C2632F3.bin
          • System.Data.OracleClient.4.0.0.0.Nullness.Generated.xml
            • 8CC4BA64.bin
          • System.Data.OracleClient.xml
            • F6BE6126.bin
          • System.Data.Services.Client.4.0.0.0.Nullness.Generated.xml
            • EB44D264.bin
          • System.Data.Services.Client.xml
            • 0547F470.bin
          • System.Data.Services.Design.4.0.0.0.Nullness.Generated.xml
            • D1A23EE4.bin
          • System.Data.Services.Design.xml
            • F917653B.bin
          • System.Data.SqlXml.4.0.0.0.Nullness.Generated.xml
            • E38BEDE4.bin
          • System.Data.SqlXml.xml
            • 5070A7FE.bin
          • System.Data.xml
            • 23380007.bin
          • System.Deployment.4.0.0.0.Nullness.Generated.xml
            • E885D1E4.bin
          • System.Deployment.xml
            • EA94258E.bin
          • System.Design.4.0.0.0.Nullness.Generated.xml
            • 8B6FCEA4.bin
          • System.Design.xml
            • A103E185.bin
          • System.DirectoryServices.4.0.0.0.Nullness.Generated.xml
            • 3FE19F64.bin
          • System.DirectoryServices.Protocols.4.0.0.0.Nullness.Generated.xml
            • F41D33C4.bin
          • System.DirectoryServices.Protocols.xml
            • 9569C5BB.bin
          • System.DirectoryServices.xml
            • C6DB3430.bin
          • System.Drawing.4.0.0.0.Contracts.xml
            • 0E821C94.bin
          • System.Drawing.4.0.0.0.Nullness.Generated.xml
            • E84B8C44.bin
          • System.Drawing.4.0.0.0.Pure.xml
            • E41F5B87.bin
          • System.Drawing.Design.4.0.0.0.Nullness.Generated.xml
            • 4E594AA4.bin
          • System.Drawing.Design.xml
            • E381B14B.bin
          • System.Drawing.xml
            • DFC4C8F7.bin
          • System.Dynamic.4.0.0.0.Nullness.Generated.xml
            • 026A7DA4.bin
          • System.EnterpriseServices.4.0.0.0.Nullness.Generated.xml
            • BBE7A364.bin
          • System.EnterpriseServices.xml
            • D976A4EC.bin
          • System.I18n.xml
            • 7E6153BF.bin
          • System.IdentityModel.4.0.0.0.Nullness.Generated.xml
            • 1106F9A4.bin
          • System.IdentityModel.Selectors.4.0.0.0.Nullness.Generated.xml
            • F4221764.bin
          • System.IdentityModel.Selectors.xml
            • FBF646E6.bin
          • System.IdentityModel.xml
            • B640054E.bin
          • System.Management.4.0.0.0.Nullness.Generated.xml
            • 686EF964.bin
          • System.Management.xml
            • B2E86CE4.bin
          • System.Messaging.4.0.0.0.Nullness.Generated.xml
            • E4DDBA44.bin
          • System.Messaging.xml
            • 55ED0AB9.bin
          • System.Nullness.Manual.xml
            • 637B83D5.bin
          • System.Numerics.4.0.0.0.Nullness.Generated.xml
            • EDBD3FE4.bin
          • System.Numerics.xml
            • B6B47E0F.bin
          • System.Runtime.Caching.4.0.0.0.Nullness.Generated.xml
            • 5DDF73E4.bin
          • System.Runtime.Caching.xml
            • D1A47BCC.bin
          • System.Runtime.DurableInstancing.4.0.0.0.Nullness.Generated.xml
            • 00BE7424.bin
          • System.Runtime.Remoting.4.0.0.0.Nullness.Generated.xml
            • 00C899A4.bin
          • System.Runtime.Remoting.xml
            • 56A58304.bin
          • System.Runtime.Serialization.4.0.0.0.Nullness.Generated.xml
            • E04CA004.bin
          • System.Runtime.Serialization.Attributes.xml
            • 19E5989E.bin
          • System.Runtime.Serialization.Formatters.Soap.2.0.0.0.Contracts.xml
            • 02345952.bin
          • System.Runtime.Serialization.Formatters.Soap.4.0.0.0.Contracts.xml
            • 55A979D4.bin
          • System.Runtime.Serialization.Formatters.Soap.4.0.0.0.Nullness.Generated.xml
            • 9AFB5084.bin
          • System.Runtime.Serialization.Formatters.Soap.xml
            • 5CB1EC55.bin
          • System.Runtime.Serialization.xml
            • 1287E84B.bin
          • System.Security.4.0.0.0.Contracts.xml
            • 515FC174.bin
          • System.Security.4.0.0.0.Nullness.Generated.xml
            • 1429DD64.bin
          • System.Security.4.0.0.0.Pure.xml
            • 6C576A67.bin
          • System.Security.xml
            • 87F08301.bin
          • System.ServiceModel.4.0.0.0.Nullness.Generated.xml
            • 3B100624.bin
          • System.ServiceModel.Activation.4.0.0.0.Nullness.Generated.xml
            • BC111F84.bin
          • System.ServiceModel.Activation.xml
            • CFF4EC5F.bin
          • System.ServiceModel.Activities.4.0.0.0.Nullness.Generated.xml
            • 23633864.bin
          • System.ServiceModel.Activities.xml
            • BC53FD80.bin
          • System.ServiceModel.Web.4.0.0.0.Nullness.Generated.xml
            • 54450C24.bin
          • System.ServiceModel.Web.xml
            • D8443DFB.bin
          • System.ServiceModel.xml
            • E4A6C365.bin
          • System.ServiceProcess.4.0.0.0.Nullness.Generated.xml
            • 2295F6E4.bin
          • System.ServiceProcess.xml
            • 25F8B321.bin
          • System.Speech.4.0.0.0.Nullness.Generated.xml
            • 87484364.bin
          • System.Speech.xml
            • 03F41C7F.bin
          • System.Transactions.4.0.0.0.Nullness.Generated.xml
            • 04CB2664.bin
          • System.Transactions.xml
            • 72142900.bin
          • System.Web.4.0.0.0.Contracts.xml
            • B50C4594.bin
          • System.Web.4.0.0.0.Nullness.Generated.xml
            • 3B53D544.bin
          • System.Web.4.0.0.0.Pure.xml
            • 686BE487.bin
          • System.Web.ApplicationServices.4.0.0.0.Nullness.Generated.xml
            • CDA1B004.bin
          • System.Web.ApplicationServices.xml
            • 700D1AFD.bin
          • System.Web.Attributes.xml
            • 33EA9D5E.bin
          • System.Web.DynamicData.4.0.0.0.Nullness.Generated.xml
            • 83110124.bin
          • System.Web.DynamicData.xml
            • 2F91696C.bin
          • System.Web.Entity.4.0.0.0.Nullness.Generated.xml
            • B585CB64.bin
          • System.Web.Entity.xml
            • 890A2A32.bin
          • System.Web.Extensions.4.0.0.0.Nullness.Generated.xml
            • 3AD965A4.bin
          • System.Web.Extensions.xml
            • 0AF5DFC3.bin
          • System.Web.I18n.xml
            • C6FEF5FF.bin
          • System.Web.RegularExpressions.xml
            • 234252F2.bin
          • System.Web.Services.4.0.0.0.Nullness.Generated.xml
            • EC463C64.bin
          • System.Web.Services.Attributes.xml
            • C138893E.bin
          • System.Web.Services.xml
            • 9E9ED327.bin
          • System.Web.WebPages.Deployment.xml
            • ABBD73FD.bin
          • System.Web.xml
            • 9CC1AA67.bin
          • System.Windows.Forms.4.0.0.0.Contracts.xml
            • 1D054254.bin
          • System.Windows.Forms.4.0.0.0.Nullness.Generated.xml
            • 1F60A904.bin
          • System.Windows.Forms.4.0.0.0.Pure.xml
            • CA37E6C7.bin
          • System.Windows.Forms.I18n.xml
            • B794E83F.bin
          • System.Windows.Forms.Manual.xml
            • BA60B1CB.bin
          • System.Windows.Forms.xml
            • 90E683E3.bin
          • System.Workflow.Activities.4.0.0.0.Nullness.Generated.xml
            • DFEA4944.bin
          • System.Workflow.Activities.xml
            • F0F8A381.bin
          • System.Workflow.ComponentModel.4.0.0.0.Nullness.Generated.xml
            • CC0C3F24.bin
          • System.Workflow.ComponentModel.xml
            • 5D69CA8A.bin
          • System.Workflow.Runtime.4.0.0.0.Nullness.Generated.xml
            • 71CB69E4.bin
          • System.Workflow.Runtime.xml
            • 26C1A9F6.bin
          • System.WorkflowServices.4.0.0.0.Nullness.Generated.xml
            • 69656B64.bin
          • System.WorkflowServices.xml
            • B1369B2A.bin
          • System.Xaml.4.0.0.0.Nullness.Generated.xml
            • 97DBE3A4.bin
          • System.Xaml.Hosting.4.0.0.0.Nullness.Generated.xml
            • DBDFBC24.bin
          • System.Xaml.xml
            • 67D55BAF.bin
          • System.Xml.4.0.0.0.Contracts.xml
            • CF0743B4.bin
          • System.Xml.4.0.0.0.Nullness.Generated.xml
            • A0DF46A4.bin
          • System.Xml.4.0.0.0.Pure.xml
            • E9628527.bin
          • System.Xml.Attributes.xml
            • F9C6A9FE.bin
          • System.Xml.I18n.xml
            • E864609F.bin
          • System.Xml.Linq.4.0.0.0.Contracts.xml
            • 582FCE74.bin
          • System.Xml.Linq.4.0.0.0.Nullness.Generated.xml
            • 4E588A64.bin
          • System.Xml.Linq.4.0.0.0.Pure.xml
            • F0AB5767.bin
          • System.Xml.Linq.I18n.xml
            • 7A027FDF.bin
          • System.Xml.Linq.xml
            • 7427FD3A.bin
          • System.Xml.xml
            • C4590EEE.bin
          • System.xml
            • 07464C3F.bin
            • 8A6D51F9.bin
          • Telerik.Web.UI.xml
            • C3A1A42A.bin
      • CustomPermission.sln
      • CustomPermission.suo
      • CustomPermission
      • SQL Script
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using CustomPermission.Model;

namespace CustomPermission
{
    public partial class loginForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void cvLogin_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = (from u in DataContext.Context.Users
                            where u.Username == txtUsername.Text && u.Password == txtPassword.Text
                            select u).Count() != 0;
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, chkRemember.Checked);
            }
        }
    }
}

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
Software Developer (Senior)
Iran (Islamic Republic of) Iran (Islamic Republic of)
Taha has started programming at the age of 16 and he has taken an avid interest in Microsoft technologies. He professionally works on ASP.NET and C#. Mainly, He lives for getting the world into codes and follows this aspiration in a third world country with lack of facility and support. He never gives up seeking success and competence.

Comments and Discussions