2

I would like to create a website using Visual Studio 2012 For Web which has a database and a generated UI such as we have if we use the template project:

Dynamic Data Entities Web Application

But I would also like to have a login page such as provided by the template project:

Asp.Net Web Forms Application

I have found that the templates are great for either of these tasks but are pretty bad if you want both of them.

If I start with the Dynamic Data Entities Web Application template then I get great pages for the data base side with very little coding to do - but I cannot manage to get the login code working (also, I don't think I should be writing that code anyway, since it already exists in the Asp.Net Web Forms Application). Whenever I try I get into a hideous mess. I don't really want to learn about authentication and membership and cookies or "how it does it" or any of that stuff. What I want is for the .Net framework to handle all of that and just tell me what the username is of the person looking at the page. That's all. And there is a way to do it, with the Asp.Net Web Forms Application template.

But if I start with the Asp.Net Web Forms Application template then the login stuff works out-of-the-box ... but then I get into a hideous mess trying to create a UI for the database! But that should not be necessary given that that code already exists in the Dynamic Data Entities Web Application template. Again, I don't really want to learn how it does it, I just want to use it to do the stuff for me so that I don't have to. I don't want to have to tell it how to update, delete etc... and I don't have to with the Dynamic Data Entities Web Application template, but then I can't get the login stuff.

Anyhow, I have torn out most of my hair with what I thought would be a pretty simple task: Create a website with login/registration with a simple database using the Code First Entities approach. My experience has been that if you want to have a database but no login then you are laughing. If you want to have a login but no database UI then you are laughing. If you want to have both then there is a lot of pain ahead unless you are a super duper Microsoft technology expert who lives and breathes this stuff.. or you know the "trick" (which probably exists in some forum somewhere).

Anyway, my question is, what am I missing here? Is there a website with a whole bunch of other templates which does have the template that combines the Web Forms (with automated login/membership control) with the Dynamic Data Entities Web Application which does a great job of displaying the tables and allowing editing? I find it difficult to believe that Microsoft intended that I have to know how to do all of the stuff that Dynamic Data Entities Web Application does and that Asp.Net Web Forms Application in order to get both functionalities.

It took me a week to figure out how to get "Enable-Migrations" to work in the Web Forms template type... Basically every small step has been a huge battle, requiring reading of forum after forum to discover little "tricks". But in the end, all I really want is a template that combines the Dynamic Data Entities Web Application capability (i.e. data driven webpages) with the Web Forms capability (i.e. user login) and to publish it on Azure. I thought that would be simple. But it turns out that it has been a nightmare and in fact I am completely stuck.

Update:

I have just spent another half-day trying to get this to work following the advice on http://msdn.microsoft.com/en-us/library/ee923692(v=vs.100).aspx . But it does not work for me. It should not be so complicated. It should not require that level of tinkering to make such a common web site format: a database with UI and a login.

Now I am back to the first problem I encountered a few days ago, which went away somehow, but I have no idea how:

PM> Enable-Migrations System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Server stack trace: at EnvDTE.Properties.Item(Object index) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at EnvDTE.Properties.Item(Object index) at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName) at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName) at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName) at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c_DisplayClass2.<.ctor>b_0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

At this point I am going to give up. I have to give up, because after a week of trying I can manage to create website on Azure with a data base and UI but no login OR a website on Azure with login but no database UI. For me to create a grid view for every one of my tables, and hook up the RowChange, UpdateMethod, DeleteMethod etc... by hand (i.e. not using the dynamic data scaffolding) would be ridiculous given that the scaffolding exists (it is just too difficult to get it to work unless I use that template from the outset, but if I use that template then I don't have a login page!). Anyhow, now this "The parameter is incorrect" error is popping up again so I am going around in circles.

user859400
  • 83
  • 3
  • 9
  • Your question is quite long my friend T_T. Reading at your diary it seems you hate to program its just that you want to use software and do all the stuffs for you. – bot Feb 21 '13 at 05:04
  • Well it's not that I hate to program it is just that I want write a program that uses the dynamic data and the web forms login, but I don't want to (and can't / do not know how to) make them since they both already exist by themselves. Really what I need to know is how to combine them. It seems that it is not so simple given that http://blogs.msdn.com/b/webdev/archive/2013/02/18/pre-release-of-asp-net-scaffolding-with-a-web-forms-scaffold-generator.aspx (but that is not for Express, and I only saw it yesterday). – user859400 Feb 23 '13 at 14:01
  • I don't think you are alone, user859400. – JustJohn Aug 31 '16 at 21:45

1 Answers1

0

You can create Dynamic Data Web sites in Visual Studio by using ASP.NET Dynamic Data templates.

Before you proceed, you must decide if you want to create a Web site project or a Web application project. For more information, see Web Application Projects versus Web Site Projects. Follow the steps in the appropriate procedure. Most of the steps you follow in order to create a Dynamic Data Web application that uses scaffolding are the same for both Web site projects and Web application projects. However, a few steps differ depending on which type of project you are using.

To create a Dynamic Data Web site project

  1. Start Visual Studio or Visual Web Developer.
  2. In the File menu, click NewWeb Site. The New Web Site dialog box is displayed.
  3. Under Installed Templates, in the left pane, select Visual Basic or Visual C#.
  4. In the center pane, select one of the following:

-To use the LINQ to SQL model, select ASP.NET Dynamic Data LINQ to SQL Web Site.
-To use the ADO.NET Entity Framework model, select ASP.NET Dynamic Data Entities Web Site.

For more information, see ASP.NET Dynamic Data Layer Customization.

5.In the Web Location box, select File System and then enter the name of the folder where you want to keep the pages of the Web site.

For example, enter the folder name C:\WebSites\DynamicData.

6.Click OK.

REFERENCE: Creating Dynamic Website

Aside from this you could also read other info's from it. And I believe nothing is impossibling to programming. If you can think it I believe you could also do it. :)

bot
  • 4,841
  • 3
  • 42
  • 67
  • But how to add a Login form to that? I think the OP knows how to create a Dynamic Data Web site but I don't think they've found anyway to attach a login form. – Daniel Hollinrake Jul 12 '13 at 11:29