How to connect Calendar control with existing Membership system in ASP.NET? - asp.net

I have a built-in Membership system in ASP.NET and I handle member data with Profiles in web.config.
I would like to add an Event Calendar where a member could add notes to any day he wants but I don't know how to integrate the Calendar control with the existing Membership system.
I can't query a database because I don't handle member login credentials manually, Login control does that for me so I would have to connect the Calendar with the existing ASPNETDB.MDF Membership database but I'm clueless.

If you are using built-in sql membership provider then it is easier. You can get Logged-in user and access database using that.
object id= Membership.GetUser(Page.User.Identity.Name).ProviderUserKey;
Now yo can store calendar data in table and link user with his calendar with his id (which is GUID).
EDIT:- Here are some links for exploring membership further.
Patterns and Practices group paper
How to video on setting up membership
In depth article at 4guysatrolla by Scott Mitchell

Related

Custom Membership provider with oAuth

It's my first contact with MVC so please be understanding for me. First of all:
1) If I will implement custom Membership provider with sql database, with my methods to activate user via e-mail, putting user into database etc. (and just one table - tableUsers), this solution about oAuth and Facebook login will works properly? Honestly, it's not clear for me at all.
2) What solution is better. My custom membership provider, or using default?
I want to sending my custom activation e-mail, then activate account. Later, I want to add new columns into userProfile table - "ID type" and "isActivated". I will storage additional info about user in separate table (telephone, webiste, about me, hobby etc) - I will get this data by IDuser from userProfile. What is more, I want to use loggin method via Facebook or Twitter. I found solution on asp.net website, how to do it with Oauth.
What solution I have to choose?
Regards
What solution is better. My custom membership provider, or using default?
As you want to store extra user information in the database, you will need to create your own custom Membership Provider as the default one lacks this flexibility. Also with the default membership Provider , you will not be able to verify your user with an activation email. You will have to customize it.
How to do it with Oauth.?
The default Membership Provider provided with MVC4 in VS 2012 has the ability to do login using Facebook and Twitter and you can add even more like LinkedIn. But, as you will need to create Custom Membership provider for storing additional information, you can use DotNetOpenAuth library for this. It is the same used by the default Membership Provider. You can add it through Nuget.

add user and assign role in aspnet membership through sql servers SP

Tech - asp.net 3.5, Sql server 2005
I have integrate aspnet membership for my webapplication.
I am adding some users (member) from importing excel file.
So how can I add that user and role of that user in aspnet membership tables?
NOTE - I have SP which is used to add member in DB from uploaded excel file, I have wrote insert trriger on membertable.
Do not insert DB records manually. Use .NET's Membership Provider's stored procedures to do that, for example aspnet_Membership_CreateUser and aspnet_Roles_CreateRole.
But better off, use .NET's classes/methods to do that. They encapsulate the whole mechanism for you:
Membership Provider
Role Provider
First you create a user, then you (optionally) attach role(s) to.
UPDATE December 2015
Folks keep reading this. It's important to know that for a few years now, there is a totally different paradigm, ASP.NET Identity. please use it instead of the old Membership Provider.
Abhi you should use
//to create a user
MembershipUser newUser = Membership.CreateUser(UserName, Password, Email);
//to attach created user some role
Roles.AddUserToRole(newUser.UserName, role);
Update
For that you can for for membership stored procedure aspnet_Membership_CreateUser to create a user or you can create one for you to insert data into user and userinroles table.
I would encourage you to refer link
You can simply do INSERT in the AspNetUsers table with empty PasswordHash and SecurityStamp. Then we have a "forgot password" flow that establishes credentials using ASP.NET Membership.

asp.net membership account valid until

I'm developing an application that requires user accounts to automatically be disabled if they haven't renewed their membership
Is there an easy way to do this with ASP.NET membership framework, where it is possible to define/set an expiration date?
Thanks
I think, in your case, you can use profile provider along with membership provider. Just create a profile property for expiry date, and set it when new user is registered. Update login functionality of site to check for expiry of user in that profile property.
That's the only simplest way I can see.
Let me know if you need more help.

How to track and load a specific user's information?

I'm making a small portal in ASP.net (with C#.net4) where users can login and add, edit their personal information (PI). But I don't get how to load information (stored in a SQL server DB) in the page when a specific user is logged in.
For example: If Sam is logged in, he can view his PI. When Vicky is logged in, she can view her PI.
who can help me with this?
thanks in advance.
You need to retain the ID of the logged in user in a session variable and then use it to filter the query with which you fetch each user's info.
So if a user's ID is 278 then your query would run as:
SELECT first_name, last_name, * FROM user_table WHERE user_id = 278
From a session variable stored like:
Session["UserId"] = currentUserId;
The ASP.NET membership provider has already taken care of this for you. Have you considered using it? You can manage all of your authentication, permissions, roles, and access/edit profile information -- which you define. You access the data via the membership objects, and you won't need to write a single line of SQL to do it. It will save you loads of work instead of trying to reinvent the wheel.
Use the regular membership as described in the other answers. Then leverage the Profile system so that each user can view/edit their info when logged in (per the question). CAVEAT: ASP.NET profile system only works out of the box with the Website project template. If you want to use the Web Application project template, then follow the steps here:
ASP.NET: Web Site versus Web Application Project
When you have the profiles up and running, the profile data can be stored in session objects while the user is logged in.

Persist custom registration information with Profile API

I've seen examples of producing a custom registration control which persists its information with some extra fields (or a table depending on the problem) in the corresponding Sql Server.
It's also said that there is a way to do the same thing with the Profile API (persist custom info in a registration control). Is there a walkthrough for this?
Thanks
Check out this link from MSDN Storing User Information with ASP.NET 2.0 Profiles
You'll also need to know how to Create the Application Services Database for SQL Server

Resources