Welcome!

Microsoft Cloud Authors: Pat Romanski, Andreas Grabner, Nick Basinger, Kevin Benedict, Liz McMillan

Blog Feed Post

ASP.NET – Membership Hides Its Privileges

One of the problems I have had thus far with my foray into ASP.NET has been a simple concept.  How do you deal with users logging in.  Not so much the actual mechanics of it, but where is the data, and how can I get to it?  By default, when you are using forms based authentication, that data is stored in tables that you cannot easily get to, and certainly not in the Solutions Explorer.  Essentially, nothing is showing up in your “App_Data” node, and there is no .MDF file to add from your project directory.

What then are you to do when you want to have direct access to your membership tables from within Visual Studio?  Well, let me walk you through the steps, as I did them, to achieve this.  I won’t say that this is the official way, but it’s what worked for me.  I hope to save you some of the pain and suffering associated with my searching on the web to find these answers.

Create your new project

This is self-explanatory.

Turn on forms based authentication

This is accomplished by editing your web.config file.  Look for the following:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" />
</authentication>
Run the ASP.NET Configuration

It’s important that you don’t look for this option (under the “Project” menu) when you have the web.config file as your open window.  It won’t be there.

Add A User

Click on the security tab, and from there you can manage your users.  Add one.  One time when I did this, I saw the following error:

The following message may help in diagnosing the problem: Could not find stored procedure ‘dbo.aspnet_CheckSchemaVersion’.

The annoying bit was that when I tested the connection, through the tool, it was able to successfully establish a connection.  Wonderful.  I am not sure how I fixed this the one time I hit it, but I wanted to throw it out there as a potential issue.

The Unfun Complicated Bit

So, this is where having a friend on the dev team is important.  I had read one of the tutorials over at asp.net which had content on this topic. They tell you to run “aspnet_regsql” from a Visual Studio command prompt.  If you do nothing else, know this: if you are using SQL Express, your server that you want to connect to is in the form of <machine name>\sqlexpress.  If you get that wrong, this tool will fail.  Always.  That’s roughly two hours I just saved you.

I am not sure what this tool did that this command line bit didn’t do for me (courtesy developer friend).

NAVIGATE TO:

C:\Windows\Microsoft.NET\Framework\v2.0.50727>

RUN:

aspnet_regsql.exe -d "<path to project dir>\<projectname>\App_Data\ASPNETDB.MDF"

With the following options:

-A all -C "Data Source=.\SQLEXPRESS;Integrated Security=True;User Instance=True"

If everything goes according to plan, you will see:

Start adding the following features:
Membership
Profile
RoleManager
Personalization
SqlWebEventProvider
…..
Finished.

If not, you will see many errors. This broke for me when the ASPNETDB.MBF file was not already there.  It showed up for me only after I had successfully built and run the project and added a user.  The asp.net mvc default app has a new user wizard, which I could also use (which I did when I hit that stored proc error above in “Add a User.”  Of course it worked, and I don’t know why.

Add the Database File

In the Solutions Explorer Window, right mouse click, and select “Add/Existing Item.”  Select ASPNETDB.MDF.  Careful that you don’t select the _log file.  I did that.  Don’t do what I did.  Fail.

There you go.  A step by step, “how the hell do I get my user tables into my project so that I can edit them” tutorial.  Hopefully this saves some poor unsuspecting n00b some time.

Read the original blog entry...

More Stories By Brandon Watson

Brandon Watson is Director for Windows Phone 7. He specifically focuses on developers and the developer platform. He rejoined Microsoft in 2008 after nearly a decade on Wall Street and running successful start-ups. He has both an engineering degree and an economics degree from the University of Pennsylvania, as well as an MBA from The Wharton School of Business, and blogs at www.manyniches.com.

IoT & Smart Cities Stories
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected pat...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.
The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
DSR is a supplier of project management, consultancy services and IT solutions that increase effectiveness of a company's operations in the production sector. The company combines in-depth knowledge of international companies with expert knowledge utilising IT tools that support manufacturing and distribution processes. DSR ensures optimization and integration of internal processes which is necessary for companies to grow rapidly. The rapid growth is possible thanks, to specialized services an...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...