Bharat Bharat - 6 months ago 44
C# Question

Stop Async call in Global.aspx

i have two mvc applications in one solution.

now i need to maintain session when user redirects from one application to another.

so what my logic is,

  • passed GUID in URL.

  • get GUID in another projects Global.asax file using Init() method.

  • Log in another user.

i done whole code, added below.

now, i am getting call in Init() method but it also calls other methods which are passed in URl.

i.e. call becomes asynch, so because of that, user redirected to other page.

do i need to change my logic or just code?
below is my Global.asax file code.

public override void Init()
var userId = Guid.Parse(Request["UserGUID"].ToString());
if (userId != null && userId == Guid.Parse("1B541D9A-AC3E-466F-897B-6F9033F4533C"))

//my logic of login management


After more then 8 hours of R&D, i found solution that really helped me.

Actually my way is proper but the method is not right.


is the proper method for my scenario.

my code is :

public class MvcApplication : System.Web.HttpApplication
    protected void Application_Start()

    public void Application_AcquireRequestState(object sender, EventArgs e)
        var userId = HttpContext.Current.Request["UserGUID"];

        if (userId != null)
            Session["UserGuid"] = Guid.Parse(userId.ToString());

            //My logic for session handling..