I have an application that I've set default language to c#, is it possible to run a .vb class inside of this IIS application?
+1
A:
You have to write your vb class on a different assembly. Then you can instance it from c# code.
despart
2009-11-06 12:59:57
A:
You could have aspx pages mixing c# and VB.NET in the same site:
defaultVB.aspx:
<%@ Page Language="VB" %>
<script type="text/VB" runat="server">
Protected Sub Page_Load(sender as Object, e as EventArgs)
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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>
defaultCSharp.aspx:
<%@ Page Language="C#" %>
<script type="text/C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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>
Of course this assumes that you don't use code behind files.
Darin Dimitrov
2009-11-06 13:06:54
+3
A:
One option is to add the file containing the class to a sub directory of the App_Code directory and set compilation to VB for that folder: http://shailkpatel.blogspot.com/2007/10/multiple-programming-languages-in.html
Assuming it's a web site and not a web application
James
2009-11-06 13:14:03