FluentSecurity icon indicating copy to clipboard operation
FluentSecurity copied to clipboard

Support MVC 5

Open KiarashS opened this issue 11 years ago • 7 comments

Hi,very thanks for FluentSecurity.

Current version of FluentSecurity suppurt MVC 5?

KiarashS avatar Mar 14 '14 10:03 KiarashS

Hi, yes it should work in MVC 5. However, it is untested and the current releases of FluentSecurity are all compiled against MVC 3. So you will need to add assembly redirects to your web and app config files.

kristofferahl avatar Mar 14 '14 11:03 kristofferahl

@kristofferahl

One thing that you could do is to add a PowerShell script to your NuGet package to detect the major MVC version and add the necessary web.config elements if they are missing (as was done here), then this step wouldn't have to be done manually.

$mvc_version = $project.Object.References.Find("System.Web.Mvc").Version
Write-Host "MVC Version: $mvc_version"
if ($mvc_version -match '^4\.') {
    Write-Host "Detected MVC 4"
    Install-MVC4-Binding-Redirects
}
elseif ($mvc_version -match '^5\.') {
    Write-Host "Detected MVC 5"
    Install-MVC5-Binding-Redirects
}

You are welcome to use the pattern that safely adds missing web.config settings without duplicating them as well as the part that saves the changes with formatting.

I have found this to be much better than using web.config transforms to do the same because that approach can blindly duplicate existing settings.

NightOwl888 avatar Mar 14 '14 15:03 NightOwl888

@NightOwl888 That's awesome... I hope to start working on the next version on monday. Maybe I'll have a look at this as well if time allows. Thanks!

kristofferahl avatar Mar 14 '14 17:03 kristofferahl

@kristofferahl, @NightOwl888 very thanks! i glad to working on the next version of FluentSecurity.

KiarashS avatar Mar 14 '14 18:03 KiarashS

FWIW, I can confirm that Fluent Security 2.0 works with MVC4 and MVC5; I'm actively using it in a client app with no issues.

tiesont avatar Mar 26 '14 09:03 tiesont

@tiesont Thanks for the feedback. Good to know it is running without any issues. And all you had to do was to add the assembly redirects?

kristofferahl avatar Mar 30 '14 10:03 kristofferahl

@kristofferahl Correct. Granted, I'm not doing anything fancy, so I can't speak to everything working correctly, but authorization seems to function properly.

tiesont avatar Apr 01 '14 03:04 tiesont