Error in ASP.NET MVC 4 with Universal Providers - asp.net-mvc

I created a fresh simple ASP.NET MVC 4 Internet Project, then I have created models with the ADO.NET Entity Data Model designer and then I have installed System.Web.Providers (Universal Providers) and configured Web.config in order to have two different data sources, both using SQL CE 4.0.
These are my connection strings:
<add name="DefaultConnection" connectionString="Data Source=C:\maindb.sdf" providerName="System.Data.SqlServerCe.4.0" />
<add name="MyEntitiesModelContainer" connectionString="metadata=res://*/MyEntitiesModel.csdl|res://*/MyEntitiesModel.ssdl|res://*/MyEntities.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="Data Source=C:\myentities.sdf"" providerName="System.Data.EntityClient" />
The application works. But when I try to login, this is the exception I get:
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
I have also added <add key="enableSimpleMembership" value="true" /> in Web.config because someone on different forums solved the problem doing this. It wasn't my case, the same error remains.
Could anyone help me please?

ASP.NET MVC4 ships with simple membership, and simple membership works with SQL CE out of the box, you don't need (and in fact can't use) the universal providers with Simple Membership.

From this ASP.NET forum post:
Thanks for the hint. Now that I was able to see that the provider was
being hijacked, I added
<appSettings>
<add key="enableSimpleMembership" value="true" />
</appSettings>
Everything Seems to be working fine now.

Related

In ASP.Net Database First Approach , Why can't i see ASPNet tables (ASPNetRoles, ASPNet users etc)

I have created ASP.NET MVC Web application but I cannot see ASPNet tables created in database.
Tried so far:
I checked in web-config file if choosing the authentication at the time of creation of project makes this difference and and found <authentication mode="None" /> in web-config. So I thought may be because i might have chosen No Authentication in the beginning that is why I dont have those tables in database. Then I have changed manually in web-config file to <authentication mode="Forms" /> to create individual user authentication.
However even after updating the authentication mode to forms it is still not showing ASPNet tables in the database.
I have noticed that ASP.Net Identity tables are created in localDb and I have created my another database with tables for my application. Now I want to see ASPNet Identity tables from local db in my own created database.
In the web-config file i have updated the data source with the data source of other connection string of my database .
<add name="DefaultConnection" connectionString="Data Source=SQLCLUSTER;initial catalog=TimeSheet;integrated security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
<add name="TimeSheetEntities" connectionString="metadata=res://*/TimeSheet.csdl|res://*/TimeSheet.ssdl|res://*/TimeSheet.msl;provider=System.Data.SqlClient;provider connection string="data source=SQLCLUSTER;initial catalog=TimeSheet;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings> ```
After running the application in debug mode I still can't see the ASPNet tables in my own database.
How can I get those tables?
What did I miss which is cause of this issue?
Any clarification would be much appreciated as I am newbie and learning Authentication and Authorisation at this point.

How to secure Elmah Page in RemoteAccess

i have an ASP MVC web site that is published.
and i adjusted <security allowRemoteAccess="yes"/> in webconfig
and now anybody can access Elmah page
by saying that i didnt use ASP.Net Identity,how can i secure ELmah Page?
I wrote a blog post a couple of months ago, that explains everything you need to know: ELMAH security and allowRemoteAccess explained. Basically, you will need to install the Elmah.MVC package and add app settings like this:
<appSettings>
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.allowedRoles" value="Admin" />
<add key="elmah.mvc.allowedUsers" value="Thomas" />
</appSettings>

Issues while calling Sitecore API

I have used mvc 5 captcha in my sitecore 8.1 based web application.But after hardening the captcha was not visible.Does any one face this kind of issues.Please help.
If the captcha Image is not displaying on the WFFM form. I imagine the configuration settings required for the Captcha are no longer present after your actions.
You need to ensure the following settings are present in are in the web.config under the node configuration/system.webServer/handers if you're using iis7 or above
<add name="CaptchaImage" verb="*" path="CaptchaImage.axd" type="Sitecore.Form.Core.Pipeline.RequestProcessor.CaptchaResolver, Sitecore.Forms.Core" />
<add name="CaptchaAudio" verb="*" path="CaptchaAudio.axd" type="Sitecore.Form.Core.Pipeline.RequestProcessor.CaptchaResolver, Sitecore.Forms.Core" />
See this link for more information or how to complete it in IIs 6

ASP.net configuration manager and outlook

i have been requested to change the authentication mode in my mvc 4 project to be windows authentication, and i was using the asp.net configuration manager.
for us, it will be a major change in the code, so is there any workaround to link our outlook active directory to asp.net configuration manager ?
Try the following setting
<appSettings>
<add key="EnableSimpleMembership" value="false" />
</appSettings>
follow the link for more details
http://www.mikesdotnetting.com/article/216/windows-authentication-with-asp-net-web-pages

How to modify the internet application for mvc projcect in Visual Studio 2012 code and connect with database?

I am beginner in ASP.NET MVC. I have been trying to create a web application in ASP.NET MVC 4 by using Visual Studio 2012. I started with internet application and open with default template that has registration, login, home etc pages. I have tried to modify the code available for the registration form as I want and connect with SQL Server database, but it does not work and also only connected with local database it is not connected with my database table I have created in SQL Server. What will I do? Thank you for your help
Have you changed your default connection string in your web.config to point your sql server?
The default connection string will be like this
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-yourproj-timestamp;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-yourproj-timestamp.mdf" providerName="System.Data.SqlClient" />
In your case you should have changed as follows,
<add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=aspnet-yourproj-timestamp;User Id = xxx;Password = xxxxxx" providerName="System.Data.SqlClient" />

Resources