While working in Visual Studio on an ASP.Net web application (that was converted from a web site project), and which has controls defined in markup in a .aspx or .ascx file, you may find that attempting to reference the controls from the code-behind file causes an error such as:
‘[Type]’ does not contain a definition for ‘[indentifier]’ and no extension method ‘[indentifier]‘ accepting a first argument of type ‘[Type]’ could be found (are you missing a using directive or an assembly reference?)
This issue results from the fact that controls created on a .aspx or .ascx page within a website project do not have a .designer file.
A potential fix is to right-click on an individual file and choose ‘Convert To Web Application’. This forces Visual Studio to create the designer partial class file. Once the .designer file is created, the controls added in the markup of the .aspx or.ascx file become visible and accessible in the code-behind file as well, with intelliSense.
While working with a combination of ASP.Net/Visual Studio/IIS/SQL Server, etc, you may occasionally come across something like:
Cannot open database “AdventureWorks” requested by the login. The login failed. Login failed for user ‘My-PC\vic’.
Where ‘My-PC’ is the PC or Workstation name and ‘vic’ is a valid user login name on the PC.
This error usually occurs when an asp.net application is configured to use IIS, and the application is trying to gain access (or login) to a SQL Server database that has not been configured with sufficient permissions for the current user of that application.
Potential fix as follows:
Under the ‘Logins’ node of the ‘Security’ node in SSMS, right-click on the user and select Properties.
Then on the Login properties dialogue click on ‘User Mapping’ in the ‘Select a page’ left window, tick the database that has the login issue in the ‘Users mapped to this login:’ in the right window, and the in the bottom window under ‘Database role membership for: [AdventureWorks]’, make sure ‘db_owner’ is ticked.
In most cases this should help resolve the issue.
You may run into this error when you attempt to reference and consume an Entity Data Model that has been created in a stand-alone project as a class library, from a new ‘client’ project such as a Windows Forms project, Windows Console App, or an ASP.Net project.
The reason for the error is, after you add a reference in the consuming project to the Entity Data Model DLL, you mustn’t forget to either:
a) create your own .config file in the consuming project and add the connectionstring entry of the Entity Data Model,
b) copy the App.config file from the Entity Data Model project, into the consuming project (by right-clicking the Project > Add Existing Item > Navigating to the Entity Data Model project and selecting its App.config file).
Also worth checking to make sure that the model’s MetaData Artifact Processing property is set to ‘Embed in Ouput Assembly’ which effectively ensures all the required schema files are embedded into the compiled DLL as resources, and are also made a part of the connection string for the model. (In the Entity Data Model project, double-click to open the model and check it’s MetaData Artifact Processing property in the Properties window, by default this should already be set to ‘Embed in Output Assembly’).
usually implies ‘ASP.NET Ajax client-side framework failed to load.’