[Mono-bugs] [Bug 46429][Blo] New - XSP from CVS bug

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 15 Jul 2003 20:03:26 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by pbaena@uol.com.ar.

http://bugzilla.ximian.com/show_bug.cgi?id=46429

--- shadow/46429	Tue Jul 15 20:03:26 2003
+++ shadow/46429.tmp.22087	Tue Jul 15 20:03:26 2003
@@ -0,0 +1,157 @@
+Bug#: 46429
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pbaena@uol.com.ar               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: XSP from CVS bug
+
+When using XSP with these files:
+
+header.inc--------------------------------------------------
+
+<%@ Page Language="C#" %>
+
+<html>
+
+<head>
+<link href="mystyle.css" rel="stylesheet" type="text/css">
+
+------------------------------------------------------------
+
+test.aspx---------------------------------------------------
+<!-- #include virtual="header.inc" -->
+<%@ import namespace="System.Configuration" %>
+<%@ import namespace="System.Data" %>
+<%@ import namespace="System.Reflection" %>
+
+ 
+<script runat="server">
+
+	static Type cncType = null;
+
+	void GetConnectionData (out string providerAssembly, out string
+cncTypeName, out string cncString)
+	{
+		providerAssembly = null;
+		cncTypeName = null;
+		cncString = null;
+		NameValueCollection config = ConfigurationSettings.AppSettings as
+NameValueCollection;
+		if (config != null) {
+			foreach (string s in config.Keys) {
+				if (0 == String.Compare ("DBProviderAssembly", s, true)) {
+					providerAssembly = config [s];
+				} else if (0 == String.Compare ("DBConnectionType", s, true)) {
+					cncTypeName = config [s];
+				} else if (0 == String.Compare ("DBConnectionString", s, true)) {
+					cncString = config [s];
+				}
+			}
+		}
+
+		if (providerAssembly == null || providerAssembly == "")
+			providerAssembly = "Mono.Data.PostgreSqlClient";
+		
+		if (cncTypeName == null || cncTypeName == "")
+			cncTypeName = "Mono.Data.PostgreSqlClient.PgSqlConnection";
+		
+		if (cncString == null || cncString == "")
+			cncString =
+"hostaddr=127.0.0.1;user=monotest;password=monotest;dbname=monotest";
+	}
+
+	IDbConnection cnc;
+	void Page_Init (object sender, EventArgs e)
+	{
+		string connectionTypeName;
+		string providerAssemblyName;
+		string cncString;
+
+		GetConnectionData (out providerAssemblyName, out connectionTypeName, out
+cncString);
+		if (cncType == null) {		
+			Assembly dbAssembly = Assembly.Load (providerAssemblyName);
+			cncType = dbAssembly.GetType (connectionTypeName, true);
+			if (!typeof (IDbConnection).IsAssignableFrom (cncType))
+				throw new ApplicationException ("The type '" + cncType +
+								"' does not implement IDbConnection.\n" +
+								"Check 'DbConnectionType' in server.exe.config.");
+		}
+
+		cnc = (IDbConnection) Activator.CreateInstance (cncType);
+		cnc.ConnectionString = cncString;
+		try {
+			cnc.Open ();
+		} catch (Exception exc) {
+			ShowError (exc);
+			cnc = null;
+		}
+	}
+
+	void Page_Load (object o, EventArgs e)
+	{
+		title.Text = "Cuaderno de visitas";
+	}
+
+	void ShowError (Exception exc)
+	{
+		noDBLine.InnerHtml += "<p><b>The error was:</b>\n<pre> " + exc +
+"</pre></p>";
+		theForm.Visible = false;
+		noDBLine.Visible = true;
+	}
+
+</script>
+
+</head>
+<body>
+
+<form id="theForm" runat="server">
+
+<span runat="server" visible="false" id="noDBLine">
+<h3>Database Error</h3>
+Sorry, a database error has occurred.
+<p>
+You should set up a database for user <i>'monotest'</i>,
+password <i>'monotest'</i> and dbname <i>'monotest'</i>.
+<p>
+Then modify the variables DBProviderAssembly, DBConnectionType and
+DBConnectionString in server.exe.config file to fit your needs.
+<p>
+The database should have a table called customers created with the
+following command (or similar):
+<pre>
+CREATE TABLE "test" (
+	"person" character varying(256) NOT NULL,
+	"email" character varying(256) NOT NULL
+);
+
+</pre>
+</span>
+
+<br>
+
+</form>
+</body>
+</html>
+-----------------------------------------------------------------
+
+XSP throws:
+Server Error in '/' Application
+Compilation Error
+Description: Error compiling a resource required to service this request.
+Review your source file and modify it to fix this error.
+
+Error message: /tmp/tmp6ee4ca8a.cs(38,0) : error CS8025: : Parsing error
+(0,0) : error .CSharp.yyParser.yyException: irrecoverable syntax error
+(0,0) : error failed: 1 error(s), 0 warnings