new here and pretty new to mvc and visual studio also. My query is this: in a mobile based web application project; i wish to have newly registered users store their geolocation on bing maps alongside their details and regularly update-able offers.
I then need users of the site that do not register to be able to view these locations and details based on their own coordinates. Can i add tables to the existing registration and login database and query everything from there or do i need to create another database?
i am using visual studio 2012 express and mvc3
sorry if this is a bit vague...
Related
I was trying to create a project in visual studio, I chose the option Individual User Account after selecting WebApi project, and now in VS 2019 it seems to be pretty different than before, now some parameters are requested, can anybody give me some examples of how to configure it?
It is asking about:
Domain Name
Application ID
Sign-up or Sign-in Policy
And by default it is selected like the only option to select:
Connect to an existing user store in the cloud
That's because you are selected API project template and trying to set Individual User Accounts mode on that but WebAPI templates don't have the Store user account in-app feature.
If you're using MVC project and try to set the Authentication mode to Individual User Accounts you'll see the Store user accounts in-app option.
Also, you can try to start your project in the console with this command as said in this answer:
dotnet new webapi -au Individual
You can open your project in VS after that. (to work around the
dialog). Then you can use for example the authorize-attribute. But the
project is still configured to use Azure Bearer Authentication. You
have to decide where to get identity from. You can take
identityserver4 or build your own "Custom storage providers for
ASP.NET Core Identity" (MS-Docs)
This is because in MVC projects you have an account controller with
views to handle registrations and get a username and password and so
forth, but there's no such a thing in WebAPI and you have to use other
authentication mechanisms like JWT.
There's a discussion about this feature in AspNetCore's Github.
I wanted to create an ASP .Net Core 2.1 REST server. For that I created a new project and choosed the "API" Template. I got it working with Entity Framework, a simple SQlite database and some GET and POST calls.
Now I'd like to add authorization (role based) to the API. I read about the Identity stuff but I just don't get it working. Is there any good tutorial or can somebody tell me how I can add authorization to my REST server? My database context already has a table "User" for the user information... thanks in advance!
If not already seen (https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-2.1&tabs=visual-studio) is well worth a look.I'm not aware of tutorials involving SQLite and Identity though have used embedded databases without problems in other Net Core apps. The Visual Studio 2017 Net Core Template using "Individual User Accounts" option adds authentication/authorization out of the box for SQL Server (Express) database with a set of login/logout razor pages. The Identity tables are quite specific and generally populated by migrations. You may find it useful to scaffold the Identity razor pages by right-clicking the project "Add => New Scafolded Item => Identity" The ApplicationModel.cs model class is used to customise the AspNetUsers table. These can all be reverse engineered using "EF Core Power Tools" (https://marketplace.visualstudio.com/items?itemName=ErikEJ.EFCorePowerTools) and recreated in another database using a custom context (eg WCX_IdentityContext.cs) by selecting "Reverse Engineer" from right-click menu. Typically you can access via the context as shown below
[Authorize]
public IActionResult Index()
{
// The home page is redirected dependent on currently logged in user details stored in the Identity tables.
if (User.Identity.IsAuthenticated)
{
using (var context = new WCX_IdentityContext())
{
// Use Identity and EF core to retrieve logged on user details
var identity = (ClaimsIdentity)User.Identity;
// The AspNetUsers Identity table contains the basic identity details
var user = context.AspNetUsers.SingleOrDefault(x => x.UserName == identity.Name);
I hope this helps you getting started.
Regards,
I Created an ASP.NET MVC 5 Website using the template of Visual Studio 2013 with Individual User Accounts to use Identity 2.0.
Also, I follow the instructions (http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity) for changing the Entity Framework layer to use Dapper.
Everything worked fine, the only issue is the multiple open connection to the Microsoft SQL Server.
When I log-in to the website, open a connection, and when I navigate to the Home and go to view the account info, or go to change a password, each navigation to a Controller open a new connection to the database. I verify the open connection in sys.sysprocesses table. Does The template have a logic error? The original template with Entity Framework handle connection well? I have to rework the original logic in the template with Identity 2.0?
I'm working on a school project and I need to implement Role-based authorization in an ASP.NET mvc3 application. Currently the application only stores the user's role in a field in the database and there is only one login page. I need to alter the entire application in other for it to grant different content to different users including admin, supervisor and counselors (counselors are able to input new client info and edit and view client information that they inputted. Supervisors can view and edit all client info and also view and edit counselor info. Admin has crud access to everything on the application.)
I'm not sure about what other info to provide about the application but i'll really appreciate any help i can get as i am new to ASP.net mvc as a whole. Most of the tutorials i found focus on specific piece of the role based approach. I need more of a bottom-up approach to implementing the roles and its authorization.
Take a look at ASPNET configuration tool. I believe that it's what you're looking for:
Visual Studio 2013 and ASP.NET Web Configuration Tool
http://msdn.microsoft.com/en-us/library/yy40ytx0.aspx
I have successfully configured FBA for my sharepoint application. So i want to create new user from sharepoint site so that they can login & see their profiles. I found webpart solutions from Here but i want to create by myself.
So how can i do this?
My another ouestion is once i create users then my users need to chane their password as well as what if they forget their password. So i need to create those webparts or application pages in visual studio.
So can anyone tell me how can i do all this stuff?
Thanks in advance.
Assuming that you are talking about SQL based FBA. Implementing these solutions is matter of calling appropriate API in SqlMembershipProvider class of System.Web.Security.
For ex, for change password, see this function:
http://msdn.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider.changepassword.aspx
Similarly, you would many functions in SqlRoleProvider class:
http://msdn.microsoft.com/en-us/library/system.web.security.sqlroleprovider.aspx