Comments (6)
Hi. Have you installed the Recode.Cocoon.Legacy package into the WebForms app?
from cocoon.
Yes I have got Recode.Cocoon.Legacy
in the WebForm app..
I've removed the Cocoon NUGET packages from the Blazor app, copied in the current projects (ReCode.Cocoon.Proxy
and ReCode.Cocoon.Proxy.BlazorServer
) from the repo and linked by project references to the Blazor app.
I found that updating the MessagePack version to 2.3.85
cured the problem. I'll leave the issue open for now until I've got the auth working on the Blazor side.
from cocoon.
Thanks for the help so far Mark.
So I have the Blazor Server app working and routes on the WebForm app are being returned correctly. If the user logged into the WebForm app, it shows the correct WebForm content for the authorised user. I've reverted to Blazor Server for .NET 5 for the present to try to get it working.
I've created an <AuthorizeView>
on my Index.razor
page but it always shows <NotAuthorized>
content, suggesting the Blazor authentication isn't recognising the WebForms auth.
The WebForm app is old-school so has the .ASPXAUTH
cookie - I set this value in appsettings.json
(as below)
"Authentication": {
"BackendApiUrl": "https://localhost:44300/facadeauth",
"LoginUrl": "/Login?ReturnUrl={{ReturnUrl}}",
"Cookies": [
".ASPXAUTH" /* was AuthCookie*/
]
},
The Startup.cs
file has the relevant setup code:
// services.AddCocoonSession();
services.AddCocoonCookies();
services.AddAuthentication(CocoonAuthenticationDefaults.Scheme).AddCocoon();
// add custom Cocoon auth
services.AddScoped<AuthenticationStateProvider, CustomAuthenticationStateProvider>();
services.AddCocoonProxy(configuration);
// lines omitted...
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapCocoonProxy();
endpoints.MapFallbackToPage("/_Host");
});
The app doesn't use sessions so this is commented out.
I can see the .ASPXAUTH
cookie in the requests via Blazor so it's being passed in. Any suggestions?
from cocoon.
I've just realised the CustomAuthenticationStateProvider
is probably a placeholder class, have copied over the CocoonAuthStateProvider
from the WASM project. I can get WingTip toys sample with BlazorServerCocoon correctly seeing the authentication state now.
I note WingTip is using the .AspNet.ApplicationCookie
cookie.. does this mean older apps using .ASPXAUTH
cookies won't work?
from cocoon.
Understanding level now increased over the last few days..
The legacy app I'm looking to port is still using ASP.NET Membership for authentication.. hence the .ASPXAUTH
cookie. So first I need to upgrade this to ASP.NET Identity before it will work correctly with Cocoon. It's a heavily customised Membership implementation so taking a while for me to do this!
I did get a test Web to work with Blazor Server on .NET 6, so it's hopefully once I have upgraded to ASP.NET Identity, I can try a new Cocoon implementation on it.
On a side note, this project would be good to showcase on the ASP.NET Community Standup - it's a great solution for users who have large WebForm apps and cannot go down the big-bang rewrite path. My app has 380 .aspx
pages, of which at least 126 need to be upgraded and 97 need evaluation!
from cocoon.
Update: finally finished converting my WebForms to use Identity, and Coccon working !
from cocoon.
Related Issues (12)
- Problems when deploying the legacy app as a subsite HOT 5
- Contributions/suggestions? HOT 1
- Bug: Unexpected msgpack code 13 (positive fixint) encountered HOT 1
- GitHub Action for PR is failing with missing VS 2019 installation HOT 3
- Security bug HOT 3
- Long HTTP requests causes YARP to Timeout HOT 2
- Wrong routing when component implements class based on ComponentBase HOT 1
- 400 error when hosted on Azure? HOT 3
- Bug: BlazorRouteDiscovery does not support multiple Route attributes
- Cocoon application getting a 400 Bad Request when making POST to web app HOT 1
- Bug: Blazor route discovery cannot discriminate subroutes after a parameter HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocoon.