本文介绍了如何在库班使用Profile.GetProfile()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚如何使用 Profile.GetProfile()方法库类。
我试图用一个Page.aspx.cs这种方法,它完美。

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.

我如何可以使在page.aspx.cs工作,工作在类库的方法。

How can I make a method that works in the page.aspx.cs, work in the class library.

推荐答案

在ASP.NET中,档案是一个勾入的属性,它返回一个类型的ProfileCommon动态生成的对象,从的。

In ASP.NET, Profile is a hook into the HttpContext.Current.Profile property, which returns a dynamically generated object of type ProfileCommon, derived from System.Web.Profile.ProfileBase.

显然的ProfileCommon包括GetProfile(用户名字符串)方法,但你不会发现它在MSDN官方记录(以及它在Visual Studio智能感知不会显示出来),因为大多数ProfileCommon类是动态生成的,当你的ASP.NET应用程序编译(属性和方法的具体名单将取决于配置文件如何在web.config中配置)。 GetProfile()确实得到这个MSDN页面一提,所以它似乎是真实的。

ProfileCommon apparently includes a GetProfile(string username) method, but you wont find it documented officially in MSDN (and it wont show up in intellisense in visual studio) because most of the ProfileCommon class is dynamically generated when your ASP.NET application is compiled (The exact list of properties and methods will depend on how 'profiles' are configured in your web.config). GetProfile() does get a mention on this MSDN page, so it seems to be real.

也许在你的库类,问题是,从web.config中的配置信息没有被拾起。是包括Web应用程序,或者你只是工作的图书馆孤立?一个Solultion你的库类部分

Perhaps in your library class, the problem is that the configuration info from web.config is not being picked up. Is your library class part of a Solultion that includes a Web Application, or are you just working on the library in isolation?

这篇关于如何在库班使用Profile.GetProfile()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 04:21