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

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

Referencing the membership user table

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :ASP.Net

When creating a foreign key to the membership user table, is it better to refer to the user_id column or is it ok to use the username column?  I assume that the Membership spec enforces uniqueness in the username since there is a method Membership.GetUser(username) that returns one user.  Using the id is a bit awkward in code because I have to end up casting all over the place like (int)user.ProviderUserKey.  The username would give more information quickly when viewing raw data as well.  Just wondering if someone knows a reason why I shouldn't use it as the foreign key.



View Complete Post

More Related Resource Links

Membership Search user


Is there a membership function to search a username Like this:   LIKE '%UserName%' ?

This is not working.

MembershipUser User = Membership.GetUser("%" + TextBox1.Text + "%");

Thank you.

=User!UserID from windows authentication using table from another database



i'm using sql server 2005, sql server business intelligence development studio for my reports and deploy them in my wss3.0 site.

what i'm trying to do is i'm trying to restrict wich users can see specific data within a report.

now, the thing is. the report gets the data out of my DB1 database and my windows authenticated user are in the WSS_content database.

when i deploy my report in my wss3 site. it gets the user that is loged in. but of course it does not display any data because the tables are not in the same database.

does someone knows how to do this?

Implementing a custom Membership Provider vs. using aspnet_Profile table - Which should I do?


I wanted to expand the amount of information that is associated with each user(MembershipUser) in the ASPNETDB.MDF database file. Adding columns like FirstName, LastName, etc. So I began implementing my own custom Membership Provider. I created a derived MembershipUser class with the extra private variables that I wanted each MembershipUser record to store. Its basically done. Almost after I did this I stumbled across the columns in the ASPNETDB.MDF->aspnet_Profile table called "PropertyNames" and "PropertyValuesString".  Could I have simply used these two columns to accomplish what I was attempting to do or are these columns for global application configuration settings?  

Is the aspnet_Profile table purpose to store expanded/related information about users such as personal information? Or is it for something else? Thanks.

Creating a table-valued function on a user defined type in SQL Server CLR

We would like to be able to create a table-valued function on a user defined type.  We would like the syntax in SQL to look like it works for the XML nodes function:   DECLARE @myXml XML = '<a><b>1</b><b>2</b><b>3</b></a>' ; SELECT  node.query('text()') FROM    @myXml.nodes('a/b') nodes (node) ;   In other words, in the FROM clause, we can access the "nodes" method of the xml variable and it returns a rowset. Thanks!

how to include a user defined table type as input for stored procedure

Hi ,  I have a user defined table type which i need to pass as input parameter to the stored procedure .How can i do that?

Referencing ConfiguratingSettings.AppSettings in a ASCX user control?

Hi there,I'm trying to reference a string from the web.config file from a ASCX user control, but I get the error message: [b]Compiler Error Message: BC30203: Identifier expected.My code in the user control file is as follows:<div id="header"><h1><%= Server.HtmlEncode(Convert.ToString(ConfigurationSettings.AppSettings["Web_Title"])) %></h1></div>Do I need to import any namespaces? Hopefully someone can help!Thanks

Use ASP.NET Membership store for user settings with Windwos Authentication

I am evaluating ASP.NET Membership for an intranet Silverlight app. I want users to be automatically authenticated for my application with their windows logon.Thus I configured Windows Authentication.I would like to store user settings like email-address in using the SqlMembershipProvider and not AD. It seems that storing user settings using the SqlMembershipProvider is not supported with Windows Authentication. Is this really so (using .NET 4)? If so: What is the rationale behind this?IMHO authentication, user settings and authorization are distinct aspects.User settings could easily be stored (identified by user name) using the SqlMembershipProvider with authentication and password management being supplied by Windows. What is the recommended solution for my scenario?

Insert and Edit Pages with Web User Control Template for another table

Hi, I have an Address template(web user control) which holds the fields of the Address table.  The Address template is embedded in the School Insert Page.  I want to insert a new school together with its address(which means I have to insert a record into the address table).  Can you let me know how I can pass the newly generated addressId to update school table?  Also, how can I associate the Address.cs in the App_Code with the Address template?  I want it to be able to scaffold columns which needs to be hidden from user in the address table.  When I click on Insert School, the Address template shows in "insert" mode, I just need to link the two together. Thanks for your help! CC  

user mapping to a database and role membership to that database

When assigning a 'user mapped Login' to a database and role membership to that database, is it redundent to check/enable db_datareader, db_datawriter as well as db_owner or will check/enable db_owner become all that is necessary to provide role membership to the database?

Get inserted ids when inserting from User Defined Table Type

Imagine this procedure:   CREATE PROCEDURE [dbo].[insertActive] ( -- Add the parameters for the stored procedure here @p_data dbo.activeUpdate readonly) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. insert into dbo.active (name,stateid) select name,stateid from @p_data END How can I get the ids of the rows that have been inserted?  I tried searching the net and the forums but could not find anything. Thanks for any and all help, Gareth.

Execution Log table shows only one user

Hi,     Im trying to get a list of users who have accessed and run reports. Im using executionlog table to get this information but strangely all the reports are being run by a single username which same as the windows service login for reporting services. Is user logging when report is accessed and executed from Report manager different from running it through report server? Does this have any impact on users being entered in execution log table? One basic question: Does the service running SSRS need access rights to datasource for running a report? Any pointers to how the execution flows from a users desktop to the logging to that user in execution log table would be very useful..   Thanks Rakesh    

Entities Data Models with multiple Categories using a membership table

(Using SQL Server 2008 and ASP.NET MVC2) I have a simple business table and a category table. I have a 3rd table to map business to category, a many-to-many relationship. the Map table contains a BusinessID and CategoryID. I'm lost as to how I can load the categories into my Business View Model using the entities model.Without incorporating categories, my code looks like this: var businessList = from b in entitiesDB.Businesses select new Models.BusinessViewModel { BusinessID = b.BusinessID, Name = b.Name } with Business View Model defined as: public class BusinessViewModel { [ScaffoldColumn(false)] public Guid BusinessID { get; set; } public string Name { get; set; } public List<Models.CategoryViewModel> Categories { get; set; } } but if i want to populate the Categories with the mapped categories, how would one do that?Thanks in advance for any help!

inserting data to Users Table in ASPNETDB from Create User Wizard


When a user starts a membership using the Create User wizard supplied by the aspnetdb profile service, I need to add a field to a table in aspnetdb and upon clicking the ContinueButtonClick insert some data.  The field I'll add is "SubscId".  My first question is what table is best for this - Users or Membership?

Secondly, what is the best way to insert new data for this scenario?  code behind?  markup?  Can someone provide basic syntax of insert code in code behind for this scenario?

Create inactive user using the membership provider


Hello all

I have a CreateUserWizard that uses the membership provider and creates a user in a sql server database.

I need to change the IsApproved property on creation to false.

I know that it can be done by createing a custom navigation template... but then i will have to code all the checks for the creation of the user...

Is there any other way to access that attribute?

this is the aspx code:

<asp:CreateUserWizard ID="createUserWizard" runat="server" Font-Names="Verdana" Font-Size="0.7em">
            <SideBarStyle BackColor="#5D7B9D" BorderWidth="0px" Font-Size="0.9em" VerticalAlign="Top" />
            <SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana" ForeColor="White" />
            <ContinueButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
                BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />
            <NavigationButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
                BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />

Why "sa" account is trying to obtain lock on user table?



I'm monitoring Lock:Timeout value on SQL database for specific table and specific type of lock (lock number 8). I'm seeing a lot of lock acquired/released as well as Lock:Timeout from "sa" account and listed as IsSystem=1.

Why is it happening. How do I catch in profiler specific details related to those locks?





P.S. This is on SQL 2008 x64 SP1.

Hide Html table according to User Group

in my site i would like to hide an html table for specific user group , how do i do that with out using Visual Studio environment and with out using c# code is there any way that it can be done like in JavaScript , need a clear picture ....

how to pass membership userID to db table


 i'm using asp.net membership for logins/registeration. i have a bookings table with few fields, lets say first_name, last_name, product_name and userID.

when the user submits 'buy' i want to get the userID from the membership user tablem that way i know whose made the booking. i'll have these two tables (bookings & user tables) linked

but how do i get userID from the user table to pass to bookings table? i checked the membership class and it gives options like

-Membership.GetUser(), Membership.GetUserNameByEmail(), Membership.GetAllUsers() etc

nothing for getting user id. user id is stored like this: c1c91682-449f-45dd-b20e-3dac5315bba4

some suggestions how to do this, plz?




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