سلام به تمام دوستان :
يه سوال : من يه web.config يه صورت زير دارم :
<?xml version="1.0"?>
<configuration>
<appSettings />
<connectionStrings />
<system.web >
<pages theme="a1">
</pages>
<anonymousIdentification enabled="true "/>
<profile >
<properties>
<add name ="fullname" defaultValue ="anonymous" allowAnonymous ="true" />
</properties>
</profile>
</system.web>
</configuration>
حال مي خواستم قبل از فرم لود به Profile.fullname دسترسي داشته باشم .
البته شايان ذكر است بايد از كد زير استفاده شود .
protected void Page_PreInit(object sender, EventArgs e)
{
txtname.text = Profile.fullname;
}
اما اين كد در vs.net 2008 و مدل web appliction جواب نميده ولي من قبلا" همچين كدي را در
vs.net 2005 مدل website ديده بودم .
پيغام خطا ميده :
The name 'Profile' does not exist in the current context
حال سوالم اينه اولا" چطور به Profile.fullname از web.config دسترسي پيدا كنم ؟
ثانيا" چرا كد بالا در vs.net 2005 مدل website جواب ميده ولي در vs.net 2008 و مدل web appliction جواب نميده ؟
با سپاس