MVC :: How To Modify Generated Membership Functionality

Mar 25, 2010

I am using ASP.NET MVC2 (and I am new to MVC).

I created a new MVC2 project and use the SqlMembershipProvider and Forms Authentication but am not using Roles (yet). Each user has additional information associated with them (e.g. Company) which is stored in a different table than the aspnet_* membership tables.

I store an additional small piece of information in the authentication cookie (e.g. CompanyId), and create a custom identity object during the AuthenticateRequest event and this custom identity object exposes the CompanyId as a property. Thus, CompanyId is available in controller actions that has been decorated with [Authorize].

When creating a new user, I now want to create this additional user information (e.g. Company) and associate it with the user. I realize there are many different ways to do this but since I am fresh to MVC I am soliciting advice about the best way to do this - I want to do it in the best "ASP.NET MVC way".

One option would be to change the AccountController's Register action and after a successful call to MembershipService.CreateUser(), do the work to create the additional info in the database. Doing it this way does not require any modification to IMembershipService etc.

Another option would be to modify the IMembershipService interface (add a "company" or "companyName" parameter to the CreateUser() method), then modify AccountMembershipService's implementation of CreateUser() and do the work to create the additional info in the database there.

And yet another option would be to leave IMembershipService alone and instead create my own IMyMembershipService and MyAccountMembershipService and use those.

View 3 Replies


Similar Messages:

MVC :: Can't Modify Auto-generated Files With Dataannotations

Feb 21, 2011

Split off from http://forums.asp.net/t/1654957.aspx/1?Validation+in+MVC+using+JQUERY+OR+JAVASCRIPT. Start new questions in a new thread.

Hey thanks a lot!!!

The following link worked fine http://geekswithblogs.net/stun/archive/2010/02/27/asp.net-mvc-client-side-validation-summary-with-jquery-validation-plugin.aspx

However, I am Having one other problem. There are four solutions in my project. All my controllers and Views are declared in the Presentation solution. There are auto-generated class files in the solution named DomainModel. So, my views inherits these auto-generated files from the DomainModel solution. The problem is that I can't modify these auto-generated files by using Data Annotations in there. Hence, cannot accomplish my validation. I tried by creating partial classes but no result. By creating a class file in my Presentation solution and then binding it with the view the validation works fine. But my views are binded with the class files (auto-generated) from the DomainModel.

Can you/anyone help me work it out so, that validation works with those classes without modifying it.

View 2 Replies

Security :: Login Functionality Using Membership Api?

Jun 7, 2010

I am using membership api in my project.I have customized all the controls.Now i want that user can login on only one machine from same username and password at the same time.If user is trying to login on any machine at that time if he is logged in from another machine.They should get message.They should not be able to log in using same username and password on same time on different machine.

View 2 Replies

Membership Select Provider / Unable To Modify The Connection

Apr 12, 2010

I've done this before but can't remember how for the life of me. I used aspnetreg_sql.exe to create the membership tables in my database. But now i cant seem to be able to point my web app to the correct database. In the provider settings in asp.net management interface i only see a radio button with the label "AspNetSqlProvider" but I can only test it (in which it always fails). I can't modify the connection.

View 3 Replies

C# - How To Add OAuth Login Functionality To Membership Website

Jul 3, 2010

I have a web aaplication which currently has a bunch of users and use Asp.net Membership to create and manage users.

I want to add OAuth functionality to my application and want to still using Asp.net Membership (login , etc ). ( and I also want my user login to application with any public social network ID , if that network use a OAuth membership.

How can I use Asp.net and OAuth (open ID) beside each other ?

I also want to add a new page for users to create a profile for themeselve.

View 1 Replies

Architecture :: Use Membership Functionality Without Username / Password?

Oct 28, 2010

1. I want to use membership functionality without username/password

instead I want to use this functionality based on tracked IP's. Is it possible

Is it a good idea? I want to use my application on all famous mobile platforms and desktops mac/win

2. Is it hard (or is it good idea) to have user info stored into database for specific amount of time based on IP instead of persistent cookies? (I mean user can close browser, etc. Usually this time will be 1 hour)

View 10 Replies

Security :: Customizing Membership Providers / Modify The Existing Sp's In Sql08

Jan 12, 2010

This is the first time i would be using .net membership providers and i need to add some extra columns and chage a couple of existing datatypes of the exising columns.

my Q is:

1)can i do this without having to suffer down the road.

2)can i modify the existing sp's in sql08 or would i need to use additional sp's for the new columns that i add.

View 4 Replies

Security :: Membership User Has To Logout - Login Again In Order To View New Role Assigned Functionality

Jul 15, 2010

i currently develop an asp.net mvc 2 web app using asp.net membership and role management for authenticating and authorizing my users. I get complaints though that when adding a role to some user, he is not able to see new role assigned functionality, unless he re-enters (logout and login again) the application.

View 2 Replies

Security :: Custom SQL Server Membership - User And Role Provider With Aspnet_regsql Generated DB Schema?

May 26, 2010

I am trying to create a Forms Authenticated site and have already used the aspnet_regsql tool to create the necessary logic in my SQL Server DB to hold my data. Now, I am looking to create a custom Membership, User and Role provider for my DB model. I was looking at the following video: [URL]

Now, I get the concept on how to go about it but I notice that this guy uses custom DB Procedures as to the ones that are generated by the aspnet_regsql tool. Can anyone direct me on where I can find info on how to go about building the Membership, User and Role provider class using the DB structure that aspnet_regsql generates? So much junk on google that I am having a hard time finding good guidance.

View 1 Replies

Security :: Custom Membership Provider Error "Could Not Load Type Custom.AspNet.Membership.PostPropertyProvider"

Jan 5, 2011

This is my first membership provider; I converted the sample provider [URL] to SQL. I created a vb class provider and put it into the App_Code folder. After it was created I tried to modify my webconfig but the error pops up. I don't know what else to try, I don't know if I have missed something

webconfig:

[code]....

View 1 Replies

Use Css File - Modify?

Jun 26, 2010

I am doing some research on themes in asp.net. (Just Learning) is this a practical use of my time? Should I just use css files and if someone wants to modify anything let them use the css to do it? Are themes a waste of my time? I really want to create my app but give the end user the ability to customize the look and feel without jumping through hoops. Can someone push me in the right direction with pros, cons etc

View 3 Replies

C# - How To Modify MapRoute (add New Dir)

Mar 26, 2010

How can I change my map route so I can have another dir, and not just the controllers and actions.What I want is to have another directory before the controller so that way I can separate controller per "module"

routes.MapRoute(
"Default", // Route name
"{module}/{controller}/{action}/{id}", // URL with params
new { module = "module", controller = "controller", action = "Index", id = ""}

This is what I want, but the code doesn't work. What more do I need to change to change the MapRoute?

View 2 Replies

.net - Modify An Asp:BulletedList In C#?

Jan 20, 2011

I've different buttons like this

<asp:Button ID="button1" runat="server" Text="single" title="single" EnableViewState="false" />

When this button is clicked I want that the text in a list like this changes

<asp:BulletedList ID="list1" runat="server" EnableViewState="false">
<asp:ListItem>Item1</asp:ListItem>
<asp:ListItem>Item2</asp:ListItem>
<asp:ListItem>Item3</asp:ListItem>
<asp:ListItem>Item4</asp:ListItem>
</asp:BulletedList>

How in C# can I select the first, the second or the third element of the list?

protected button_Click(object sender, EventArgs e)
{
list1. ...;
}

View 1 Replies

How To Modify Dataset Data

Jan 12, 2011

I'm trying to call a dataset, modify a value, and then put it back into a dataset.

I think this is possible but I'm doing something wrong

attached is an image of the table and the code

[Code]....

View 3 Replies

VB.net Getting Last Inserted Record / How To Modify It To Get The Last Id

May 12, 2010

I know this is a common request, I've googled loads but found lots of complicated code for such a simple task.

My basic insert code is below, can someone tell me how/ where I can modify it to get the last ID?

[code]....

View 7 Replies

ASMX :: Modify SoapAction In WCF?

Apr 2, 2010

My application uses the default URL http://tempuri.org rather then using specific URL. In my C# code, how do I change the SoapAction? Is it in the ServiceContract? OperationContract? I'm not sure.

This is in the binding level.

View 1 Replies

C# - Modify <param> Value From Code?

Dec 23, 2010

I am trying to embed a visio doc in an aspx page using the following code

<OBJECT classid="CLSID:279D6C9A-652E-4833-BEFC-312CA8887857"
codebase="http://download.microsoft.com/download/4/5/2/452f8090-413f-408f-83c0-edd66db786ee/vviewer.exe" [code]...

i need to modify the value parameter SRC from code , how do i go about it ?

View 2 Replies

Modify DomainService Code?

Oct 24, 2010

How can one modify DomainService code without the custom code being overwritten?

Is there a way to put the custom code in a seperate class file?

View 1 Replies

MVC :: Modify The Routes Dictionary?

Feb 16, 2010

how to do routing. My problem basically relates to "logged in" and "logged out routes" and having both as "/".

i.e. I have home/index for logged out user which appears as "/" but this has got me confused as to how I can have home/home for logged in user and still have "/".

I keep getting 127.0.0.1/home/home

I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/index.

how I can modify the routes dictionary (which will be binded ONCE at the start) so that the "/" can be shared for logged and non-logged users ?

View 8 Replies

Hide Or Modify The Url Extension?

Feb 24, 2011

I want to hide or modify the url extension by default it is set to aspx. Can it be modified in asp.net

View 2 Replies

Open And Modify Text File?

Feb 12, 2011

I have a C# web application (VS 2005).

I need to open an existing text file and add data to each row.

View 4 Replies

How To Modify Re Dim Preserve For Dynamic Array

Oct 21, 2010

I wrote the following code to preserve the values of a dynamic array

but the 2nd time around I get the 'ReDim' can only change the rightmost dimension.

Here is the code ...how should I modify it? Initial lead_count value is 0

[Code]....

View 1 Replies

To Modify Source And Add A Little Scriplet Inside It?

Apr 19, 2010

I m trying to modify a .aspx page which i think is precompiled.(Whenever i open any aspx file it contains following "This is a marker file generated by the precompilation tool, and should not be deleted!").Is there any chance that i can modify source and add a little scriplet inside it?

View 6 Replies

Web Forms :: How To Modify Hyperlink Using FindControl

Apr 15, 2010

I have a literal control on a page that gets it's value from a resource file like this...

<asp:Literal ID="Literal2" runat="server" meta:resourcekey="Literal2Resource1"></asp:Literal>

The resource file contains the following HTML code...

<a runat=server id="bylchau" href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306">Bylchau</a>

Therefore when the page is loaded it renders a hyperlink to the page.

What I want to do, is modify the href of this hyperlink after the page has loaded (in Page_LoadComplete??)

Have tried the following but get error, 'Object reference not set to an instance of an object.'

Dim quicklink As HtmlAnchor = DirectCast(Form.FindControl("bylchau"), HtmlAnchor) quicklink.HRef = quicklink.HRef + "boo"

What I was hoping for is that the href of the anchor would change to href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306boo"

View 9 Replies

How To Dynamically Modify Several Controls On A Page

Jan 5, 2010

I'm thinking there has to be an efficient and OO way to do this.

I have several textboxes on a data entry page. When I need to make a new entry, I have to clear the text field before making new entries and this has to be done for quite a number of textboxes and across several pages.

Is there a way to use the FindControl method to locate all textboxes on a page and clear their textfields probably using a loop of some sorts?

View 2 Replies







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