User Still Exists In Roles.GetUsersInRole After DeleteUser() With DeleteAllRelatedData = False

Jan 13, 2010

I have an account called "admintest" which is "admin" as its role. I called the following line to delete the user with deleteAllRelatedData=false because I just want to mark the user as deleted (I may need to retrieve users' history later)

bool result = Membership.DeleteUser("admintest", false);

After that, I call the following line to get the user:

string[] users = Roles.GetUsersInRole("admin");

But I still get "admintest" in the users array.

View 1 Replies


Similar Messages:

C# - Find All User That Are NOT In A Specifv Role Using: Roles.GetUsersInRole Or Different?

Jan 27, 2011

I need populate an array with a list of Users that ARE NOT PRESENT in a specific Role and COUNT the result.At the moment I use this code, but I am not able to get the Users outside "CMS-ADMINISTRATOR " role.Any idea how to do it and better write the Count section?

string[] usersInRole;
usersInRole = Roles.GetUsersInRole("CMS-ADMINISTRATOR");
int c = usersInRole.Count();

View 3 Replies

Membership.deleteuser() Returning False - Not Deleting The User

Nov 21, 2010

I am trying to delete an asp.net user from all tables. When I call: bool isDeleted = Membership.DeleteUser(username, true); isDeleted is being set to false; Is there a way to tell why it is not deleting the user?

View 4 Replies

C# - DirectoryInfo And Path.GetDirectoryName - Exists Method Returns False While Exists?

Dec 13, 2010

I would like to check whether a folder exists or not if not create. I'm sure this folder exists, but for some reason I get "false" when I check with "Exists" method.

The only reason I think could be because of the W: drive? I moved this application to production site and even there it returns false.

while I'm type in Windows explorer on my localhost and on the server "W:/Webs/ASPPages/cropper/uploads" it opens this folder. So my localhost and IIS server has W: mapping.

for test I tried to create the folder then it says can't find the path...

userFolderName = @"W:/Webs/ASPPages/cropper/uploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried "W:\Webs\ASPPages\cropper\uploads"
DirectoryInfo dirInfo = new DirectoryInfo(userFolderName);........

View 3 Replies

Security :: Delete The Member From The Aspnet_membership Table And Roles Related Tables Using Membership.DeleteUser

Mar 21, 2010

I've created a membership system based on asp.net 2. There are other tables that store user information, such as emails sent etc. I've created a users table based on the TableProfileProvider. My question is concerning deleting the member

Is it OK to delete the member from the aspnet_membership table and roles related tables using Membership.DeleteUser, though keep all the custom tables and the information including the information in the Users table created by the TableProfileProvider? or can you foresee problems?

View 1 Replies

Security :: Membership.DeleteUser Not Removing User From Database

Jun 29, 2010

Membership.DeleteUser not removing user from database

//Roles.RemoveUserFromRole("markwheeler1963@hotmail.com", "customer");

View 6 Replies

C# - Membership.DeleteUser (UserName,true) Not Removing User From Role

Mar 25, 2011

When I click the "delete" linkbutton, it can delete the all User info from my "UserDetail" table in my "JobPost.mdf", it also delete the corresponding "aspnet_Users" & "aspnet_Membership",but the "UserInRole" still contain that UserName. Even though I specified the Code:Membership.DeleteUser(UserName, true);

I thought true is for bool deleteallrelated data, but it doesn't really delete the userInRole. So next time the user registers with the same name, it automatically get the "admin" role right. This "deleteUser" page I keep it inside a protected "admin"folder. How to solve it? Why Membership.DeleteUser(UserName, true) doesn't delete UserInRole?

protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string UserName = e.CommandArgument.ToString();
Membership.DeleteUser(UserName, true);
JobPostDataContext db = new JobPostDataContext();
var query = from u in db.UserDetails
where u.UserName == UserName
select u;
foreach (var item in query)
{
db.UserDetails.DeleteOnSubmit(item);
}
db.SubmitChanges();
FormsAuthentication.SignOut();
}
}
My web.config inside the protected Admin folder:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow roles="Administrators" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

View 1 Replies

Security :: Membership.DeleteUser (UserName,true) Not Removing User From Role

Mar 25, 2011

I have a "UserDetail" table in my "JobPost.mdf". When I click the "delete" linkbutton, it can delete the all User info from my "UserDetail" table, it also delete the corresponding "aspnet_Users" & "aspnet_Membership",but the "UserInRole" still contain that UserName. Even though I specified the Code:Membership.DeleteUser(UserName, true);

I thought true is for bool deleteallrelated data, but it doesn't really delete the userInRole. So next time the user registers with the same name, it automatically get the "admin" role right. This "deleteUser" page I keep it inside a protected "admin"folder. How to solve it? Why Membership.DeleteUser(UserName, true) doesn't delete UserInRole?

protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string UserName = e.CommandArgument.ToString();
Membership.DeleteUser(UserName, true);
JobPostDataContext db = new JobPostDataContext();
var query = from u in db.UserDetails
where u.UserName == UserName
select u;
foreach (var item in query)
{
db.UserDetails.DeleteOnSubmit(item);
}
db.SubmitChanges();
FormsAuthentication.SignOut();
}
}
My web.config inside the protected Admin folder:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
<allow roles="Administrators" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

View 1 Replies

Security :: Function File.Exists() Always Returns False?

Apr 14, 2010

Our web application hosted from windows 2003 server, is trying to access a file present in a shared folder of another windows 2003 server. The path for the shared folder is configured in the webconfig file in the below format.

<add key="ReportPath" value="\<Server_Name>Reports"/>
if (!File.Exists(ReportPath))
/ Show the report in a link

This function File.Exists() always returns false and when I try to remove the check, it returned the exception, "Logon failure: unknown username or bad password."

View 2 Replies

How To Make All Of The Roles Defined In RoleGroup> Required? (i.e. User Must Meet All Roles)

Feb 24, 2011

Let's say I have a rolegroup as follows:

<asp:LoginView ID="lvDoSomeStuff" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="RoleOne,RoleTwo">
<ContentTemplate>
...
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>

Is there a way I can make it so that a user must meet RoleOne and RoleTwo to satisfy the RoleGroup? By default, if a user is in either of the two roles, they will be granted access. I know I can do this via the code-behind, but I'd prefer to be able to wrap some content template with this markup instead of having to wrap it in a panel and hide the panel programmatically.

View 1 Replies

Data Controls :: Alert Return False On Confirm True And Return True On Confirm False On Value Exists

Mar 26, 2016

I have an approve button.on clicking on this button it should show that an inactive value is present .Onclicking yes conformation it should save the data or else clicking on no conformation should return false; how i will do that?After alert it always submit the data. 

protected void ibtApprove_Click(object sender, ImageClickEventArgs e)
{

string otherAffiliateName = txtRequestedAffiliate.Text;
int inActiveAffiliates = new BLRating().InActiveAAffiliateChecking(otherAffiliateName);
if (inActiveAffiliates > 0)

[code]...

This is the code i used.how i wiil stay back on Confirm 'no' click?

View 1 Replies

SQL Server :: How To Check (true/false) If Every Single Entry In Table Exists In Other Table

Oct 15, 2010

I have 2 tables:

- Salesmen with Pk.SalesmenID
- Appointments with Fk.SalesmenID and busy(bit)

How can I check if every salesmen has at least one appointment

Am I on the right way with statement below, though I got syntax problems

[Code]....

View 5 Replies

MVC :: "Path" To Linked File - FileInfo.Exists Always False?

Nov 30, 2010

i set up Log4Net in a project, with the Log4Net.config file in "App_Data/config/Log4Net.config", and called the XmlConfigurator.Configure function with the following:

[Code]....

However, I the config file to be available in multiple projects, so moved it out to a solution folder (config/Log4Net.config).

Back in my MVC project, I added the config file as a linked file (and also set it to a "embedded" resource and "copy always" for the heck of it)

However I got no idea how the previous "var configfile = new FileInfo("????")" should read.

Tried it with and without Server.MapPath, using "Log4Net.config", "/Log4Net.config", "~/Log4Net.config", etc. No luck.

My guess it's because this Log4Net.config is not an actual file, but just linked.

View 4 Replies

C# - GetUsersInRole DataSource For DropDownList

Nov 22, 2010

I need to display in DropDownList a list of "Users" belonging a specific ROLE. This is my code:

// Find DropDownList
DropDownList myUserList = (DropDownList)uxInsertAuthorInput.FindControl("uxUserListSelector");
// Bind data to DropDownList
myUserList.DataSource = Roles.GetUsersInRole("CMS-AUTHOR");
myUserList.DataBind();
myUserList.DataTextField = "UserName";

My problem is when a visitor select an item in DropDownList. The actual value passed is the "UserName" and not the "UserId". I need to use the "UserId" value when a visitor select an item from DropDownList. How to do it?

View 2 Replies

User Controls :: Save And Retrieve CheckBoxList Values As Per User Roles?

Feb 26, 2014

i need a script on ASP.net that can build this form.

1.Users === Drop Down Menu then in the Drop down should be the names of all Taafoo staff.

View 1 Replies

User Controls :: How To Set User Roles During Registration

May 7, 2015

In Below link show to how to Imaplement role based security, Page access and show / Hide Menu items based on Role in asp.net

[URL]

But My Questions is How to Register Admin and Client user?

View 1 Replies

Check User Id Already Exists?

May 22, 2010

i am building a project using C# Asp.Net in which i am registering users with a user id, now my question is that how to check that the user id is already exists in the user table or not when user trying to register, i am using sql server 2000?

View 3 Replies

C# - Check User Id Already Exists?

May 22, 2010

I am a beginner coder, i am building a project using C# Asp.Net in which i am registering users with a user id, now my question is that how to check that the user id is already exists in the user table or not when user trying to register, i am using sql server 2000?

View 4 Replies

Can User Have More Than One Roles

Apr 3, 2010

I'm developing a web application I want to use the role authentication to control different parts of the website accessibility. But my problem is say I implemented a upload and download functionality on one of the page and I want to have the ability to control a user whether they can either upload or download; or both. So, I'm not exactly sure if the role base authentication can support a user with more than one role to work the way I want it.

View 1 Replies

Security :: Add Membership User Check If Exists?

Dec 13, 2010

I would like to create a sync process between an ADSI table and aspnet Membership using Membership.CreateUser. However, I need to see if a user exists before importing. I can import as long as a user does not exist however I am having trouble checking if users exist and only importing if they do not. Here is my code so far.

[Code]....

View 1 Replies

Redirect To Homepage When No Session Exists For Web User?

Feb 4, 2011

I have a web app with loads of pages and most of them require some session variables in order to function.i want to put some defensive code in my master page's page_load or init events to detect if the user has a session (meaning any session variable instead of a particular variable) and if not redirect them to the homepage to start all over. whats the best way to do this? should i use session_end instead?a simple solution for this would be best.EDIT:so i am guessing the master page is the place i want to add this to?

View 3 Replies

Web Forms :: How To Check Whether User Already Exists In Database

Jan 23, 2012

what is code of "user already exists in database" using asp.net 3.5

View 1 Replies

How To Check If File Exists On User Machine

May 7, 2015

web application How to check file exists on local machine..?

View 1 Replies

Losing User Roles?

Aug 11, 2010

I am baffled, I am using a treeview to set the source of an iframe. The web page is being displayed correctly, but User.IsInRole("roleName"), in the code behind, always returns false. The strange thing is User.Identity.Name returns the correct user name. I have tried setting the target of the tree view nodes to "_blank" and to "_self" and still no luck. So, it doesn't appear that the problem is related to the iframe.Before the treeview was added, javascript was used to set the source for the iframe and User.IsInRole returned the correct values.

View 4 Replies

How To Add .net User .net Roles For Application From IIS

Sep 6, 2010

I am not sure is there any other way to add User for my application othe than using Asp.net Website admistration tool??

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved