asp.net 2.0
I want to search for 1 specific profile in my code. So I'm trying to use the
FindProfileByUserName method.
But before I use that method I must establish a provider object that can
call this method...
Here is part of my code:
String username = Request.QueryString["USERNAME"];
int totalProfiles;
SqlProfileProvider provider = (SqlProfileProvider)
Profile.Providers["SqlProvider"];
ProfileInfoCollection profiles =
provider.FindProfilesByUserName(ProfileAuthenticat ionOption.Authenticated,
username, 0, 1, out totalProfiles);
Much of this code is taken from the MSDN documentaion. my problem is that
this line don't work:
SqlProfileProvider provider = (SqlProfileProvider)
Profile.Providers["SqlProvider"];
The "provider" variable is still null after that line is executed, this
causes my code to crash... maybe it's a bad idea of my to specify provider
to be of the SqlProfileProvider class?
Here is my web.config file:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
</appSettings>
<connectionStrings>
<add name="aspnet_DB" connectionString="Data
Source=.\\SQLEXPRESS;Integrated
Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true" />
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="true"/>
<profile enabled="true">
<properties>
<add name="Picture" type="System.Byte[]" />
<add name="PictureType" type="string" />
</properties>
</profile>
</system.web>
</configuration>
Any suggestions to what causes this?
jeffHey
I've found a work around to this problem so it isn't so urgent for me..
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23Lt0ZHvnGHA.964@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
hey
>
asp.net 2.0
>
I want to search for 1 specific profile in my code. So I'm trying to use
the FindProfileByUserName method.
But before I use that method I must establish a provider object that can
call this method...
>
Here is part of my code:
String username = Request.QueryString["USERNAME"];
int totalProfiles;
SqlProfileProvider provider = (SqlProfileProvider)
Profile.Providers["SqlProvider"];
ProfileInfoCollection profiles =
provider.FindProfilesByUserName(ProfileAuthenticat ionOption.Authenticated,
username, 0, 1, out totalProfiles);
>
Much of this code is taken from the MSDN documentaion. my problem is that
this line don't work:
SqlProfileProvider provider = (SqlProfileProvider)
Profile.Providers["SqlProvider"];
The "provider" variable is still null after that line is executed, this
causes my code to crash... maybe it's a bad idea of my to specify provider
to be of the SqlProfileProvider class?
>
Here is my web.config file:
<?xml version="1.0"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
</appSettings>
<connectionStrings>
<add name="aspnet_DB" connectionString="Data
Source=.\\SQLEXPRESS;Integrated
Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true" />
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="true"/>
<profile enabled="true">
<properties>
<add name="Picture" type="System.Byte[]" />
<add name="PictureType" type="string" />
</properties>
</profile>
</system.web>
</configuration>
>
>
Any suggestions to what causes this?
>
jeff
>
0 comments:
Post a Comment