J
Jeff
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(ProfileAuthenticationOption.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|aspnetdb.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
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(ProfileAuthenticationOption.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|aspnetdb.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