What assemblies are loaded by default when you create a new ASP.NET 2.0 Web Application Project? - asp.net-2.0

What assemblies are loaded by default when you create a new ASP.NET 2.0 Web Application Project ?

Generate a list of loaded assemblies in the current application domain using AppDomain.GetAssemblies() to see everything that's loaded
Assembly[] loadedAssemblies =
AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in loadedAssemblies)
{
Response.Write(assembly.FullName);
Response.Write("<br />");
}

The ones you reference plus the mandatory ones like : mscorlib, System, System.Web, System.Xml
To check which assemblies are referenced in a new web application, check the References subfolder in the Solution Explorer.

System
System.Configuration
System.Data
System.Drawing
System.EnterpriseServices
System.Web
System.Web.Mobile
System.Web.Services
System.XML

Related

VB.NET Web Form Project Reference Issue

I have a project solution having multiple class library projects and one main web application which have the project reference for the other class library project.
The class libraries have the 2.0 framework but the web application have 4.0 framework.
For e.g.
Ecommerce.GoogleCheckout (Class Library/2.0 Framework)
Ecommerce.IV1.Core (Class Library/2.0 Framework)
Website (Web Application/4.0 Framework)
I cannot change the framework for the class library project as this project is already developed and have many dependencies, I have got this project for maintenance.
The problem is when I added new classes in one of the class library project and build the project individually it compiles perfectly but when I build the whole solution it gives the following error-
Type 'Ecommerce.IV1.Core.Catalog.xxxxxxxxx' is not defined.
I have added the proper import statements to access the project namespaces-
Imports Ecommerce.IV1.Core
All the other classes from the same directory/namespace are properly accessible in the web application project
Please let me know if any more information it required. Any help or guidance would be appreciated as I have very tight timelines.
Regards,
Manik
Check in your app.config for the following configuration:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Make sure that useLegacyV2RuntimeActivationPolicy is set to true.

Project referencing error

I have an ASP.NET application (presentation layer) that references a VB.NET class library (Business Logic Layer), which references another VB.NET class library (Data Logic Layer).
When I step through the code in the code behind files I am now seeing an error:
Could not load type 'DataLogicLayer.classname' from assembly
'DataLogicLayer, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'.":"DataLogicLayer.classname"}System.Exception
ClassName is from the Data Logic Layer. I am not sure how to troubleshoort this error.
(I have checked that the assemblies appear in the BIN folders.)
I had a reference to an old assembly in the web.config of the web application. Removing the assembly reference resolved the problem.

Using wsdl.exe output interface file with myPage.aspx.vb - Cannot reference interface or Web Reference

I am creating a webpage that needs to use a webservice wsdl at a remote url (https://sitename/ws/general.asmx)
I added the webservice to the project folder as generalWS (right click in VS2010, add Web service) and the editor recognizes the webservice methods.
I then used wsdl.exe to create the proxy file general.vb, which has partial classes and an interface, and copied it into my project folder.
Im now trying to reference this webservice by creating a new object for the webservice, but it does not compile:
BC30002: Type 'GeneralWS.general' is not defined.
Can someone guide me in the right direction?
Do I need to reference the interface file in the aspx.vb file?
Do I need to do something special with the web.config file?
Thanks!
Deploying on IIS6.0 with .NET Framework 2.0
Using MS Visual Studio 2010
myPage.aspx.vb
Imports System.Web.Services
Imports System.Xml
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page
'declare the web services
Public wsg As New generalWS.general() ''ERROR COMPILE LINE''
'
'
'
'
generalWS.vb
Public Interface generalSoap
Function1
Function2
'
'
Public Partial class method1
Public Partial class method2
Public Partial class method3
Instead of using "Add Web Reference" within Visual Studio, I used "Add Service Reference".
On the server side, I upgraded to .NET 3.5

ASP.NET membership/SQLMembershipProvider Source Code

In the SQLMembershipProvider source for ASP.NET membership, there is a custom exception, MembershipPasswordException.
The definition of it is not part of the source, but when I do a goto definition on it, it opens the definition, which indicates: [from metatdata] and the file it came from is a dll, system.web.dll from a temporary directory.
How did that get there or was it part of the msi install that the toolkit provider came with?
When using Reflector I saw that it's directly in the System.Web.Security namespace. When you take a look at the code and Visual Studio notices it's already in an assembly it knows about and you digg deeper on it it'll open it's metadata.
Both SqlMembershipProvider and MembershipPasswordException are part of the System.Web assembly and live in the System.Web.Security namespace. Microsoft just didn't include the MembershipPasswordException in the source code that comes with the toolkit.

Removing CompilerOptions directive for an interop

I've created an interop for a COM dll via tlbimp and added it to the assembly cache. To use this in an ASP.net page i need to include the following
<%# Page Language="VB" Debug="true" CompilerOptions='/R:"C:\Program Files\blah\blah\LIBRARY.dll"'%>
<%# Import Namespace=LIBRARY %>
Why do i need the CompilerOptions directive if it's in the assembly cache? Can i simplify and centralize this?
You should just be able to add a reference just as you would add any other assembly reference. That's all /R: does.
EDIT: If you're not explicitly building the web app elsewhere, using /R in the aspx file is probably your best bet. The reason you need it is that ASP.NET is effectively building the application for you, and something needs to tell it which library to reference, even if that library is in the GAC. It's just like normal assembly references in a Visual Studio project - if you remove a reference to System.Xml, you won't be able to use the XML classes even though that assembly's in the GAC.

Resources