'The 'Name' and 'Src' attributes are mutually exclusive in aspx page without code behind
I have a webform (default.aspx) page without code behind in my website. Here i am using a dll reference to call method from it. Below are the Code details what i have done.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<%@ Import Namespace="System.Data;"%>
<%@ Import Namespace="System.Data.SqlClient;"%>
<%@ Assembly name="ClassLibrary" Src="~/Bin/ClassLibrary.dll"%>
<script language="c#" runat="server">
public void Page_Load(object sender, EventArgs e)
{
ClassLibrary.Class1 obj = new ClassLibrary.Class1();
Response.Write(obj.Test());
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
When I am starting executing my website it gives an error The 'Name' and 'Src' attributes are mutually exclusive
Solution 1:[1]
This means you can have one or the other. IE, <%@ Assembly name="ClassLibrary" %> or <%@ Assembly Src="~/Bin/ClassLibrary.dll"%>
Basically, 'Name' is going to tell it to go look for an assembly in the GAC and private probing path for a matching assembly, while 'Src' tells it the Assembly you want to load is 'right here at this path'.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | B.O.B. |
