.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

The role '' was not found

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net


I get this strange Server Error when I try to create a new user and add him to a role:

Roles.AddUserToRole(CreateUserWizard1.UserName, "Admin");

Why does it change 'Admin' to '?

In my web.config I have:

<roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
      <add name="CustomizedRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="aspnetDBConnectionString"/>

aspnetDBConnectionString is the same connectionstring I use for my MembershipProvider and my LinqToSQL (.dbml) so it's working.

?Everything is sworking fine on my dev. computer but not in the web-hotel environment. I'm using SQL Server 2008 and i've checked the aspnet-tables and views to verify that everything is the same in both environments. What else could cause this error?


View Complete Post

More Related Resource Links

The role '' is not found - error message

 Everything in the function below works as I would expect until  line 14 where it says they role "" was not found, even though debugger clearly shows that the role paramater is set to "admin" on the function call.

I was not having this problem until I made the switch from a mdb role data base to running the aspnet_regsql util to insert all the tables and sprocs into the normal database, but I have double checked and everything seems fine below.

Thanks for the help 


        <add name="Strutster" connectionString="Data Source=(local)\SqlExpress;Initial Catalog=Strutster;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="MyMembershipConnStr" connectionString="Data Source=(local)\SqlExpress;Initial Catalog=Strutster;Integrated Security=True" providerName="System.Data.SqlClient"/>

<membership defaultProvider="MyMembershipProvider">
                <add name="MyMembershipProvider"

Handling 404 page not found with Error page



      How do i handle 404 page not found?

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



scripts file not found on server - 404


Fiddler is showing a 404 error when my published web application runs. the jquery.js file in
/scripts is highlighted in red by fiddler as not found. ( IIS log also shows the 404 error ).
I run the web app from visual studio, on local host - no problems. The publish is successful.
All the files are in the scripts folder of the web app on the server.

In the site.master I have:
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

Visual studio does not complain about this. ( which indicates the file is found. )

Oddly, when I fully qualify the path, VS says file not found, but after I publish and run, fiddler
shows the jquery file being found and sent to the browser.
<script src="/MvcApplication1/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

when the <script> path is "../../Scripts/jquery-1.4.1.min.js", the fiddler error is
404: /Scripts/jquery-1.4.1.min.js .

when the <script> path is "/MvcApplication1/Scripts/jquery-1.4.1.min.js", fiddler shows the file
being sent to the browser from that /MvcApplication1/Scripts path.

Both the Scripts fol

urlrouting - page not found error


I have a dynamic data site setup and running locally fine from vs 2008.

When i deploy to a remote windows 2003 server (IIS6), all the pages also work ok apart from one page/table.  I can access it's list page,  but the edit and insert pages throw 404 errors.

I'm thinking it's a url routing/hosting issue as i've copied back the database from the remote server and it all works fine on my local machine.

Is there anything i can do to debug this behaviour?

Below is my register routes entry from the global.asax

Any suggestions greatly appreciated as, i've been stuck on this for days :(

public static void RegisterRoutes(RouteCollection routes)
    MetaModel model = new MetaModel();
    model.FieldTemplateFactory = new AdvancedFieldTemplateFactory();

    model.RegisterContext(typeof(Sponsorship.Data.Entities), new ContextConfiguration() { ScaffoldAllTables = false });
    model.DynamicDataFolderVirtualPath = "~/admin/DynamicData";

    routes.Add(new DynamicDataRoute("admin/{table}/{action}.aspx")
        Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),

Page not found using ASP.NET Development server


Hi to all forum members

I got this problem. When I try to run a test project I receive "Page not found" in browser opened by ASP.NET Development server. I am logged as administrator to my WIN XP. And I am using VS2005. I had VWD and ASP.NET 2.0 before but  removed everything before installing VS2005. Do you hav eany idea why is this happening.

p.s. I do not use any firewall only nod32 as antivirus program

I will be very glad is someone can help me.

DirectoryEntry type not found


 Can someone tell me why the system does not recognize DirectoryEntry in the code below?  It indicates DirectoryEntry cannot be found. 

using System;
using System.Collections;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.DirectoryServices.AccountManagement;

public partial class MyADGroups : System.Web.UI.Page

       public static ArrayList getuserattributes(string objectDn) 
        DirectoryEntry objRootDSE = new DirectoryEntry("LDAP://" + objectDn);
        ArrayList props = new ArrayList();
        foreach (string strAttrName in objRootDSE.Properties.PropertyNames)
        return props;



Compiler Error Message : CS0006: Metadata file 'System.EnterpriseServices.dll' could not be found


I get this error when i Debug my web application....


I followed these steps.,

  • Ended the aspnet_wp.exe process in the Windows Task Manager
  • Then deleted the application`s folder in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
  • Then started Visual Studio 2008 again

I also rebooted my system but no use....

Plz help !

Bitmap FromFile space "file not found"


I am using aspose.slides to create PPTx's. Some of the process involves loading jpg's from another server and including them in the presentation. This works fine in my development environment. When I upload the site to its server, the jpg loading fails.

I am trying to access jpg's on the other server by:

   oFS = New FileStream(sFile, FileMode.Open, FileAccess.Read)

This causes an access violation error when run from the server.

I also boiled the code down to reading the file directly:

   oImg = System.Drawing.Bitmap.FromFile(sFilePath)

This causes a file not found error.

We have narrowed the problem down to the fact that the File Path has a space in it. How does one solve this problem (while still keeping the space, there is a lot of legacy data)? I have tried replacing the space with %20 or +. I have tried using Server.UrlEncode. The error message always comes back with the encoding in place (like no decoding

Test-Driven Design: Using Mocks And Tests To Design Role-Based Objects


Use Test-Driven Development with mock objects to design object oriented code in terms of roles and responsibilities, not categorization of objects into class hierarchies.

Isaiah Perumalla

MSDN Magazine June 2009

Patterns in Practice: Object Role Stereotypes


Object role stereotypes can help you better understand and clarify the responsibilities of the objects in your application.

Jeremy Miller

MSDN Magazine August 2008

Authorize It: Use Role-Based Security in Your Middle Tier .NET Apps with Authorization Manager


Authorization Manager in Windows Server 2003 represents a significant improvement in the administration of role-based security, making it more scalable, flexible, and easier to implement. Using Authorization Manager, you can define roles and the tasks those roles can perform. You can nest roles to inherit characteristics from other roles, and you can define application groups. In addition, Authorization Manager lets you use scripts to modify permissions dynamically, and it allows you to wrap your security logic in a security policy that can be stored in Active Directory. Authorization Manager also includes an easy-to-use API for running access checks. The author discusses all of these topics and demonstrates them with a working sample.

Keith Brown

MSDN Magazine November 2003

Talking To.: Don Box Discusses Web Services and His New Role at Microsoft


Don Box has long been the preeminent expert on COM, as well as one of the creators of the SOAP protocol. He has written numerous books and articles including Essential COM (Addison-Wesley, 1997) and Essential .

MSDN Magazine December 2002

Security: Unify the Role-Based Security Models for Enterprise and Application Domains with .NET


Role-based security allows administrators to assign access permissions to users based on the roles they play rather than on their individual identities. These privileges can be used to control access to objects and methods, and are easier to identify and maintain than user-based security. The .NET Framework provides two role-based security models, which are exposed as two namespaces: System.Enterprise-Services and System.Security.Permissions. Presented here is a comparison of the two options and a discussion of when each is the right choice. The author also demonstrates the process involved in setting up access security and discusses role memberships.

Juval Lowy

MSDN Magazine May 2002

Any decent docs on DD? All the ones I found are for .NET 3.5



I've been trying to find some up-to-date docs for DD in .NET 4 and have beens struggling. Most of the info out there seems to be for 3.5, along with a lot of comments about not using now as there's so much new stuff in the latest version.

I've seen the MSDN pages, which look typical MSDN, ie great if you want to look up a specific feature, but not necessarily the best place to learn from scratch.

Anyone know of any good learnign resources?


MySqlMembershipProvider.CreateUser no suitable method found to override



I am getting following error while using MySqlMembership Provider. Can any one help me to solve this?


MySql.Membership.MySqlMembershipProvider.CreateUser(string, string, string, string, string, bool, object, ref System.Web.Security.MembershipCreateStatus)': no suitable method found to override.

        <membership defaultProvider="MySQLMembershipProvider">
                <add name="MyMembershipProvider"

        <roleManager enabled="true" defaultProvider="MySQLRoleProvider" />

using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Configuration.Provider;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;
using MySql.Data.M
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend