GithubHelp home page GithubHelp logo

Missing Cookies about systemweb-adapters HOT 7 CLOSED

dotnet avatar dotnet commented on August 11, 2024
Missing Cookies

from systemweb-adapters.

Comments (7)

twsouthwick avatar twsouthwick commented on August 11, 2024

Can you describe a bit more what your setup is and what you are seeing? Ideally, a small repro would be helpful. I cannot reproduce this; i.e. the cookies show up (assuming I have accessed the backend at some point or enabled session locally). Here are the cookies I see in the samples in this project:

image

The required anti-forgery cookie "__RequestVerificationToken" is not present.

This is known and tracked here: #75

from systemweb-adapters.

bsulliva avatar bsulliva commented on August 11, 2024

@twsouthwick, not sure what else you need on the setup, please let me know. But whenever I'm on the new .net core site, and hit a URL that is proxied to the old .net framework site, I'm missing cookies. If I look at the request in the browser, in dev tools, it's missing the asp.net session cookie, request verification cookie and some custom cookies we set. Now I do see on the response the .net cookies are being set, but I end up with a new Session ID on each request. I have not setup Session sharing between the new .net core site and the old one. I'm guessing I need to setup session support before I start seeing the Session ID cookie?

from systemweb-adapters.

twsouthwick avatar twsouthwick commented on August 11, 2024

If you could provide a minimum viable repro so that I can try it out locally that would help. If that's not possible, sharing your Program.cs/Startup.cs for the core side (and any additional config you did on the Global.asax) would be a starting point.

The sample projects in the solution don't exhibit this behavior so I'm not sure what is missing.

from systemweb-adapters.

bsulliva avatar bsulliva commented on August 11, 2024

I'll try to create a whole new solution and share the code with you. Below is my program.cs for the core side. For the global.asx, you need it from the legacy .net frameworks site?

using Microsoft.AspNetCore.SystemWebAdapters;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSystemWebAdapters();
builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));

// Add services to the container.
builder.Services.AddControllersWithViews();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();
app.UseSystemWebAdapters();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapReverseProxy();

app.Run();

from systemweb-adapters.

bsulliva avatar bsulliva commented on August 11, 2024

Noticing other weird things. We have CspViolationException being logged and seeing these. Probably nothing to do with why I'm not seeing cookies, but just wasn't sure what it is.

M.Web.Http.CspViolationException: 
DocumentUri="https://localhost:7266/cart/cart"
EffectiveDirective=""
ViolatedDirective="default-src"
OriginalPolicy="default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:; report-uri https://www.mdev.com:44333/mvc/cspreport"
BlockedUri="wss://localhost:44377/M_Web.Core/"
UserAgent=""
Referrer=""
StatusCode=""
SourceFile="https://localhost:7266/_framework/aspnetcore-browser-refresh.js"
LineNumber="234"
ColumnNumber="24"
ScriptSample=""
Mouser.Web.Http.CspViolationException: 
DocumentUri="https://localhost:7266/cart/cart"
EffectiveDirective=""
ViolatedDirective="default-src"
OriginalPolicy="default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:; report-uri https://www.m.com:44333/mvc/cspreport"
BlockedUri="ws://localhost:2711/799c6d1bc1474deaa6f07091e478b347/browserLinkSignalR/connect?transport=webSockets&connectionToken=AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAA9XSQ9H%2BLL0WkY4VokVIEpwAAAAACAAAAAAADZgAAwAAAABAAAACHFAXH4tPU1vegZ3HhvEhxAAAAAASAAACgAAAAEAAAAENyxO2CdCyVboWy55ebn8soAAAA0pxplpd%2BJzj9u5ppVRZe54jM8tmRTypAM%2Bv3yqnyKeJ0rJIslFJLfBQAAACaJJHM11jl%2FL9DaaETrnJsdo2eGw%3D%3D&requestUrl=https%3A%2F%2Flocalhost%3A7266%2Fcart%2Fcart&browserName=&userAgent=Mozilla%2F5.0+(Windows+NT+10.0%3B+Win64%3B+x64%3B+rv%3A102.0)+Gecko%2F20100101+Firefox%2F102.0&browserIdKey=window.browserLink.initializationData.browserId&browserId=79ca-0aec&tid=10"
UserAgent=""
Referrer=""
StatusCode=""
SourceFile=""
LineNumber=""
ColumnNumber=""
ScriptSample=""

from systemweb-adapters.

adityamandaleeka avatar adityamandaleeka commented on August 11, 2024

I'll try to create a whole new solution and share the code with you.

That would be great, please create the repro and share it as a Github repo.

from systemweb-adapters.

adityamandaleeka avatar adityamandaleeka commented on August 11, 2024

@bsulliva I'll close this issue now since we haven't heard from you in a while. If you do create the repro and want to share it with us, please reopen the issue.

from systemweb-adapters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.