Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated mysql connector, added virtual host config, fixed solution to…

… run with membership under Mono 2.8 with .net 4.0 profile
  • Loading branch information...
commit 8c61a0d0abacf740cd422a35bd1e58c0d77cde47 1 parent 86dd156
@nathanb authored
View
BIN  sample-asp4-mvc2/lib/MySql.Data.dll
Binary file not shown
View
BIN  sample-asp4-mvc2/lib/MySql.Data.pdb
Binary file not shown
View
BIN  sample-asp4-mvc2/lib/MySql.Web.dll
Binary file not shown
View
BIN  sample-asp4-mvc2/lib/MySql.Web.pdb
Binary file not shown
View
18 sample-asp4-mvc2/src/SampleASP4MVC2.Web/Models/AccountModels.cs
@@ -15,31 +15,21 @@ namespace SampleASP4MVC2.Web.Models
[PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public class ChangePasswordModel
{
- [Required]
- [DataType(DataType.Password)]
[DisplayName("Current password")]
public string OldPassword { get; set; }
- [Required]
- [ValidatePasswordLength]
- [DataType(DataType.Password)]
[DisplayName("New password")]
public string NewPassword { get; set; }
- [Required]
- [DataType(DataType.Password)]
[DisplayName("Confirm new password")]
public string ConfirmPassword { get; set; }
}
public class LogOnModel
{
- [Required]
[DisplayName("User name")]
public string UserName { get; set; }
- [Required]
- [DataType(DataType.Password)]
[DisplayName("Password")]
public string Password { get; set; }
@@ -50,23 +40,15 @@ public class LogOnModel
[PropertiesMustMatch("Password", "ConfirmPassword", ErrorMessage = "The password and confirmation password do not match.")]
public class RegisterModel
{
- [Required]
[DisplayName("User name")]
public string UserName { get; set; }
- [Required]
- [DataType(DataType.EmailAddress)]
[DisplayName("Email address")]
public string Email { get; set; }
- [Required]
- [ValidatePasswordLength]
- [DataType(DataType.Password)]
[DisplayName("Password")]
public string Password { get; set; }
- [Required]
- [DataType(DataType.Password)]
[DisplayName("Confirm password")]
public string ConfirmPassword { get; set; }
}
View
36 sample-asp4-mvc2/src/SampleASP4MVC2.Web/SampleASP4MVC2.Web.Publish.xml
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<publishData>
- <publishProfile publishUrl="C:\Code\Git\iws-snippets\sample-asp4-mvc2\build" deleteExistingFiles="True" ftpAnonymousLogin="False" ftpPassiveMode="True" msdeploySite="" msdeploySiteID="" msdeployRemoteSitePhysicalPath="" msdeployAllowUntrustedCertificate="False" msdeploySkipExtraFilesOnServer="True" msdeployMarkAsApp="False" profileName="Default" publishMethod="FileSystem" replaceMatchingFiles="False" userName="" savePWD="False" userPWD="" SelectedForPublish="True">
- <file relUrl="bin/SampleASP4MVC2.Web.dll" publishTime="11/22/2010 14:46:21" />
- <file relUrl="Views/Home/Index.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="bin/SampleASP4MVC2.Web.pdb" publishTime="11/22/2010 14:46:21" />
- <file relUrl="Scripts/MicrosoftAjax.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Global.asax" publishTime="11/17/2010 09:57:00" />
- <file relUrl="bin/MySql.Data.pdb" publishTime="11/22/2010 14:42:41" />
- <file relUrl="Scripts/jquery.validate-vsdoc.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/jquery-1.4.1.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Shared/LogOnUserControl.ascx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/MicrosoftMvcAjax.debug.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/MicrosoftMvcValidation.debug.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="bin/MySql.Data.dll" publishTime="11/22/2010 14:42:41" />
- <file relUrl="Scripts/jquery.validate.min.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Account/ChangePassword.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/jquery.validate.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/jquery-1.4.1.min.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Home/About.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Account/LogOn.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Account/Register.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/MicrosoftMvcAjax.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Account/ChangePasswordSuccess.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Shared/Site.Master" publishTime="11/17/2010 09:57:00" />
- <file relUrl="bin/MySql.Web.dll" publishTime="11/22/2010 14:42:42" />
- <file relUrl="Views/Shared/Error.aspx" publishTime="11/17/2010 09:57:00" />
- <file relUrl="bin/MySql.Web.pdb" publishTime="11/22/2010 14:42:42" />
- <file relUrl="Web.config" publishTime="11/22/2010 14:46:28" />
- <file relUrl="Content/Site.css" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/MicrosoftAjax.debug.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/MicrosoftMvcValidation.js" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Views/Web.config" publishTime="11/17/2010 09:57:00" />
- <file relUrl="Scripts/jquery-1.4.1-vsdoc.js" publishTime="11/17/2010 09:57:00" />
- </publishProfile>
-</publishData>
View
12 sample-asp4-mvc2/src/SampleASP4MVC2.Web/SampleASP4MVC2.Web.csproj
@@ -34,23 +34,21 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
- <Reference Include="MySql.Data, Version=6.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+ <Reference Include="MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\MySql.Data.dll</HintPath>
</Reference>
- <Reference Include="MySql.Web, Version=6.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+ <Reference Include="MySql.Web, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\MySql.Web.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
- <Reference Include="System.ComponentModel.DataAnnotations">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
@@ -118,9 +116,7 @@
<Content Include="Views\Shared\Site.Master" />
<Content Include="Views\Web.config" />
</ItemGroup>
- <ItemGroup>
- <Folder Include="App_Data\" />
- </ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
20 sample-asp4-mvc2/src/SampleASP4MVC2.Web/Web.config
@@ -8,8 +8,8 @@
<configuration>
<connectionStrings>
<add name="Default"
- connectionString="data source=127.0.0.1;user id="
- providerName="System.Data.SqlClient" />
+ connectionString="data source=127.0.0.1;user id=aspnet_user;password=secret_password;database=membership;"
+ providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.web>
@@ -37,7 +37,11 @@
Mono runtime. But I can't bring myself to share sample code that doesn't hash the
passwords by default. ;) The version included with this sample project is slightly modified to
allow hashed passwords in Mono. I highly recommend checking out the latest version of
- MySql .NET Connector. http://dev.mysql.com -->
+ MySql .NET Connector. http://dev.mysql.com
+
+ Also, I found that you have to rebuild MySql.Data and MySql.Web
+ using .NET 4.0 profile if you want it to work with Asp.Net 4.0 under Mono. This is a known bug and should
+ be published in upcoming versions of the connector. -->
<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
@@ -93,6 +97,16 @@
<customErrors mode="Off"/>
</system.web>
+ <system.data>
+ <DbProviderFactories>
+ <clear/>
+ <add name="MySQL Data Provider"
+ description="ADO.Net driver for MySQL"
+ invariant="MySql.Data.MySqlClient"
+ type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
+ </DbProviderFactories>
+ </system.data>
+
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
View
46 sample-asp4-mvc2/ubuntu.conf
@@ -0,0 +1,46 @@
+<VirtualHost *:80>
+ ServerName ubuntu
+ ServerAdmin web-admin@ubuntu
+ DocumentRoot /srv/www/ubuntu
+ # MonoServerPath can be changed to specify which version of ASP.NET is hosted
+ # mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
+ # For SUSE Linux Enterprise Mono Extension, uncomment the line below:
+ # MonoServerPath ubuntu "/opt/novell/mono/bin/mod-mono-server2"
+ # For Mono on openSUSE, uncomment the line below instead:
+ MonoServerPath ubuntu "/opt/mono-2.8/bin/mod-mono-server4"
+
+ # To obtain line numbers in stack traces you need to do two things:
+ # 1) Enable Debug code generation in your page by using the Debug="true"
+ # page directive, or by setting <compilation debug="true" /> in the
+ # application's Web.config
+ # 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
+ MonoDebug ubuntu true
+
+ # The MONO_IOMAP environment variable can be configured to provide platform abstraction
+ # for file access in Linux. Valid values for MONO_IOMAP are:
+ # case
+ # drive
+ # all
+ # Uncomment the line below to alter file access behavior for the configured application
+ MonoSetEnv ubuntu MONO_IOMAP=all
+ #
+ # Additional environtment variables can be set for this server instance using
+ # the MonoSetEnv directive. MonoSetEnv takes a string of 'name=value' pairs
+ # separated by semicolons. For instance, to enable platform abstraction *and*
+ # use Mono's old regular expression interpreter (which is slower, but has a
+ # shorter setup time), uncomment the line below instead:
+ # MonoSetEnv ubuntu MONO_IOMAP=all;MONO_OLD_RX=1
+
+ MonoApplications ubuntu "/:/srv/www/ubuntu"
+ <Location "/">
+ Allow from all
+ Order allow,deny
+ MonoSetServerAlias ubuntu
+ SetHandler mono
+ SetOutputFilter DEFLATE
+ SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
+ </Location>
+ <IfModule mod_deflate.c>
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
+ </IfModule>
+</VirtualHost>
Please sign in to comment.
Something went wrong with that request. Please try again.