Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mukesh Kumar 7 posts 87 karma points
    Apr 14, 2020 @ 20:43
    Mukesh Kumar
    0

    Issue while accessing session value

    I am facing one weird issue while accessing session value in my Umbraco 8 website. So we are having 2 website one is public facing Umbraco website and second is secured website to be accessible after login as a normal MVC application hosted as subdomain in IIS. When I try to access login information set inside session in normal application inside Umbraco application it always return null value. This issue occurs only when we read session data in my Umbraco application. When I return back to another application I am able to get session value. Wondering if I am missing something while retrieving the session value in my Umbraco application? Anyone have any idea, what could be the reason of this issue? Thanks in advance..

    Controller code setting the Session value it pretty straight forward:

    Controller:

    public class UserController : Controller

    Method:

    [HttpPost] public string SetSession(OnlineUser UserObj) { Session["UserInfo"] = UserObj; return null; }

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Apr 14, 2020 @ 22:21
    Alex Skrypnyk
    1

    Hi Mukesh

    Can you provide code examples, please?

    Thanks,

    Alex

  • Mukesh Kumar 7 posts 87 karma points
    Apr 15, 2020 @ 06:42
    Mukesh Kumar
    0

    Hey Alex, thanks for quick response. It was a simple Session add and getting the value in View. Here is the simple code snippet used:

    In second MVC site which I hosted in IIS within my main Umbraco site to work as a subdomain:

    Session["UserInfo"] = UserObj;

    In Umbraco layout page:

    var userInfoSession = System.Web.HttpContext.Current.Session["UserInfo"];

    Both are using the same Application pool. Wondering what cause the Session value not accessible between both sites..

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Apr 15, 2020 @ 11:21
    Alex Skrypnyk
    0

    What type of controller are you using? Can you show all controller code?

  • Mukesh Kumar 7 posts 87 karma points
    Apr 15, 2020 @ 12:06
    Mukesh Kumar
    0

    Hi @Alex, I have updated my question to include the details..

Please Sign in or register to post replies

Write your reply to:

Draft