how to use Profile.GetProfile() in a library class?

后端 未结 3 1982
野的像风
野的像风 2021-01-20 01:24

I cant figure out how to use Profile.GetProfile() method in a library class. I tried using this method in a Page.aspx.cs and it worked perfectly.

How ca

3条回答
  •  野性不改
    2021-01-20 01:54

    Have you tried adding reference to System.Web.dll to your class library and then:

    if (HttpContext.Current == null) 
    {
        throw new Exception("HttpContext was not defined");
    }
    var profile = HttpContext.Current.Profile;
    // Do something with the profile
    

提交回复
热议问题