http://bugzilla.novell.com/show_bug.cgi?id=522540
User [email protected] added comment http://bugzilla.novell.com/show_bug.cgi?id=522540#c1 Marek Habersack <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CLOSED Resolution| |INVALID --- Comment #1 from Marek Habersack <[email protected]> 2009-07-16 03:03:39 MDT --- (In reply to comment #0) > Using "~" in the web.config file for a connectionString doesn't work with > either xsp2 or mod_mono using SqliteMembershipProvider and "Forms" > authentication. > > <?xml version="1.0"?> > <!-- > Web.config file for mycode. > > The settings that can be used in this file are documented at > http://www.mono-project.com/Config_system.web and > http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx > --> > <configuration> > <connectionStrings> > <add name="MySqlConnection" > connectionString="URI=file:~/App_Data/aspnetdb.sqlite"/> > </connectionStrings> Actually, I don't think this is a bug. Connection strings are not handled in any way by System.Web. Their handling belongs in the data provider which, in turn, _cannot_ depend on System.Web since it may be used outside ASP.NET - therefore it can't use MapPath to solve ~/path/ into physical path. The issue you're seeing is that mod_mono is ran within apache and apache's working directory is not the application's root but, most probably, filesystem root (or apache's home/docroot directory) so relative paths need to be handled from that point. You can check what is the working directory by printing it from somewhere in your application. Also, System.Web cannot preprocess the connection string since their format and syntax is provider-specific. Basically, you have several ways of handling the situation from within your application: 1. If you access the connectionString from your code-behind like: WebConfigurationManager.ConnectionStrings ["MySqlConnection"]; Then you can just preprocess the URI part yourself by calling MapPath on the part which specifies the file before passing the string to Sqlite 2. If you access the connectionString from markup using expressions like: <tag runat="server" ConnectionString="<%$ ConnectionStrings: MySqlConnection %>"/> Then you have two choices: 1. Derive a new expression builder from System.Web.Compilation.ConnectionStringsExpressionBuilder and override the GetCodeExpression method so that it calls your version of the static GetConnectionString method. Your version of that method needs to preprocess the string by using a MapPath 2. Like above, just write a totally new expression builder 3. Use the |DataDirectory| macro in the connection string in place of ~ This method looks up the AppDomain data item called "DataDirectory" which is set by hosting environment to the full path of your ~/App_Data/ -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
