Kind of frustrated with various host and the forced changes that seem to make a simple deploy a nightmare. Ok. Can anyone create a simple ONE to TWO PAGE ASP.NET website that requires login authentication using the built in features that sets up users, roles and accompanying database and upload it to discountasp.net???? This is the mdf file that comes from the wizard so this is not MS SQL or Express. I believe it is Access Database. My sites work fine offline. But uploading has been a terrible experience. I need this because discountasp.net is the host I've chosen as well as plan to choose for other user sites I have in the making. I got the invalid AttachDB error and I think I've gotten around it from a post in the form where you change the datadirectory in the Global. I don't see that anymore. But suddenly everything is not a recognized namespace. System.Web.Optimization???? Seriously? Now Web. is not a recognized namespace???? Everything was copied up so that includes references and what have you. I can deal with having to be forced to change the Datadirectory to _database, although I don't understand why aside from making people use MS SQL Add-on... but all of the namespacing issues should not happen with a simple copy up to the host. It really is defeating the purpose. So no code. If someone does this on a regular or has knowledge could you please post it. VB or C#. Doesn't matter. Just need a simple 5 min website that requires authentication from the wizard. NO CUSTOM CODING. NO JAVASCRIPT. Not yelling just trying to emphasize this because people have a tendency to give you what works for them rather than what you need. And any coded please provide the ENTIRE coding. This means the "using" and "import" statements as well. And of course the Web.config and what you did to point from App_Data to _database folder. I rather do it this way because me posting will result in back and forth, back and forth, back and forth... just adding to the frustration. Once someone post this then I can see what I need to do to get other sites up that require authentication. I can post them minus requiring authentication. Soon as that is added everything breaks. Namespaces that it once understood now it doesn't. Thanking anyone who helps in advance. I'm using VS 2012, but I also have VS 2008. Either one is fine. I just need that simple website so I can figure out what is going on.
And please don't ask me for the errors and code, because I'm really looking for the code from you. If you KNOW how to get what I asked up and running please post that and if I get it going my first priority is to get the site up using that method and possible make a tutorial that I'm surprised is not up considering this is basic for VS users to start experimenting with authentication. Thanks!
This is a common issue. .MDF is actually SQL Express file (or SQL data file). What you'll need to do to get membership working is to Upload the mdf file into the _database directory Log onto the control panel and navigate to the MS SQL tools Attach the database file Update your web.config's connection string to point to the attached database
Hi FrankC, Thanks for the reply, but I will need more detail information as I'm not familiar with your tool set. I see IIS Tools, Web Application Tool, and Control Panel API. I see Database Management where MS SQL Manager is listed. I downloaded an extension for IIS 7 called DataBase Manager. I never get the views I see in the video of the tool because it errors out. I included a MS 2008 prerequisite as well. But I'm getting no where with this. And are you basically saying I need to MS SQL Add-on in order to use the Authentication/Role/User feature? I need to know this because I am doing a report on cost of migrating websites to discountasp.net Thanks!
Hi goodsensesys, Yes, you're going to need to use a SQL Server add-on with your hosting account. You can order this add-on through our control panel's add-on page here: https://my.discountasp.net/addons/ Once you have ordered the correct SQL database add-on. Upload the .MDF file to your _database directory in your web site files. You can use an FTP client like FileZilla. FileZilla can be downloaded here: http://filezilla-project.org/ To learn how to connect to your site using FileZilla please read our knowledge base article here: http://support.discountasp.net/KB/a311/configuring-filezilla-to-access-your-web-site.aspx Once connected you can navigate to the _database directory. Or if this directory isn't created. Go ahead and create it using the FTP client. Then upload the .MDF file into this directory. (The _database directory is protected by our web server and people wont be able to download it or browse this directory) Once you have uploaded the .MDF file go into the SQL Tools in our control panel under the SQL database and use the " Attach Data File" tool to attached the .MDF file to our SQL database. Then update the connection string to connect to our SQL database in your web application. More information about our SQL Tools in our control panel can be found in our knowledge base article here: http://support.discountasp.net/KB/a188/sql-2008-management-tools.aspx
Thanks Martino... I must say I'm a little disappointed that I have to purchase SQL Add-on just to implement authentication using a small database for a small business. I thought the SQL add-on was for bigger databases like an eCommerce site would require. Hopefully just a few more questions. Excuse me if they sound redundant. I don't mean them too. I just want to make sure I understand what I can and cannot do. I don't want to pay for an add-on unless it is necessary. SQL Express I've read in different threads that SQL Express is not supported. Is this to say I can't upload a database created with SQL Express? SQL Compact Edition. Do you support SQL Compact Edition? I've never used it, but I understand it is geared more towards the web and should just require uploading the DLL to the bin directory. Finally.. I probably should have asked this first. The "App_Data" directory is of no use to users since it appears you must upload to "_database" directory, am I correct? Thanks again!
SQL Express: It is not supported in a production environment because of licensing issues, and it does not scale well. It was meant to be used by developers to test their application prior to deploying it to a production environment. SQL Compact Edition: It is supported, and yes, you need to upload the .sdf and .dll files to make it work. App_Code App_Data Bin _database are special folders. For more information about these folders, see this link: http://msdn.microsoft.com/en-us/library/t990ks23(v=vs.80).aspx You can store your database in either App_Data or _database folders or any really. Your application just has to point to it correctly.
Thanks RayH, I have the Compact Edition working locally. So no more Express. Now the issue is the provider. I've already went with this ErikEJ version and like I said it works locally, but when I load everything up, the roleprovider entry is claiming it is not a valid win32 application. So I have to find out what that is all about. I understand there maybe another version, but at this stage I don't want to have to do so much clean up of removing or updating web.config entries. The thing is I might get a resolution for this and then another one might popup as well at the rate this is going. So hopefully once I get this straightened out I can get to where I should be already. This has really killed my time though. I had hoped to have 3 sites up and running. I think there needs to be a change in how programs sell the idea of publishing to the web because it isn't that simple anymore.
Ok. I saw this http://www.hanselman.com/blog/Comme...d97c-7176-47a2-a05c-9d9ce464d4a2#commentstart I'm using this method. This is suppose to be with SQL CE, but when I follow this I still get the MDF database with the tables. The SDF database is empty of the necessary tables shown in the MDF database. I've uploaded pictures of the solution server, the tables to the databases and the configuration file. This actually authenticates even with the SDF file as my only connection string and default database with no tables. I'm not sure what I'm missing but something is not right. And I'm going to add on the SQL for myself, but I need this for lightweight websites that only require an admin login to do whatever they want to do. Alter configuration. Whatever. Do I need to manually recreate the tables in SDF? I thought the commandline took care of creating this like it does for the MDF file????? This is just a dummy application I'm using to determine what I need to do to quickly put up a site using SQL CE. Thanks!
Yes, you would probably need to recreate the tables in the SDF file. That MDF file is usually created by SQL Server Express. I don't see it in your web.config, but your application might be referencing the MDF file in some way. You don't necessarily need to put the connection string in the web.config file. You can also put it in your code.
You might want to take a look at this link: http://www.hanselman.com/blog/Intro...lesAndUserProfileOnSQLCompactAndSQLAzure.aspx
Hi Ray, I am using that link you provided as my guide, but all the guides are for MVC, Entity, Azure, etc... And it never shows the result of setting up SQL CE, like tables, etc... as you get with the MDF file. I'm sure I'm leaving out something that is usually assumed when people write up these documents, but I'm not sure what it is. I know MVC and Entity Framework is the the thing now, but I really need a Web Forms example without Entity Framework for now.
The reason I provided that link was for you to try the Universal Providers or something called Simple Membership. I don't think the ASP.NET Membership providers will work in this case partly because I forgot that SQL CE does not support things like triggers and stored procedures. When you create the membership tables through Visual Studio or the aspnet_regsql.exe utility, I believe it also creates stored procedures as well. Someone can correct me if I'm wrong, but it's been a while since I've worked with login forms and membership, and I don't use SQL CE that much.
Hi Ray, I changed over from ErikJ to that link you gave me for the same reason you gave me the link. Lol. on ErikJ's page it stated to use the new universal providers and it had the same link in it. I think you may have answered one of my questions earlier when you said I need to manually recreate the tables in the SDF that gets created in the MDF. I just wish there was an example from someone who has done this using Asp.net Web Forms and ADO.NET rather than MVC, Entity Framework and Azure. The web config is pointing to the SDF and I commented out the MDF. <connectionStrings> <add name="DefaultConnection" providerName="System.Data.SqlServerCe.4.0" connectionString="Data Source=Data Source=|DataDirectory|\DatabaseSQLCE4.sdf"/> <!-- <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WBGv1-20130801192916;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WBGv1-20130801192916.mdf" /> --> </connectionStrings> I'll try again from scratch. /8 Reusing this code maybe an issue. But I will recreate the page from scratch, install the providers and manually creates tables in the SDF.
Sorry, I'm unable to help more. If I have some time, I'll play around with VS to see if I can get something working. In the meantime, you might want to take a look at this link regarding Simple Membership: http://weblogs.asp.net/jgalloway/ar...-5-web-forms-and-asp-net-mvc-4-templates.aspx
This blog might be more helpful: http://blog.osbornm.com/2010/07/21/using-simplemembership-with-asp-net-webpages/