Monthly Archives: November 2010

Configure ASP.NET role provider

  1. Run “aspnet_regsql.exe” from c:windowsmicrosoft.netframeworkv2.0.50727
  2. Add the Network Service account to your logins for the SQL Server be sure to set the User Mapping for this account to aspnetdb (the default database)
  3. Select in the databse aspnetdb the role “aspnet_membership_Fullaccess; right click and add the Network Service account to this role
  4. Add the following entry to your connectionstrings settings in the web.config:
        <add name="MySqlRoleManagerConnection" connectionString="Data Source=.;Initial Catalog=aspnetdb;Integrated Security=SSPI;" />
        

    Alternatively you could adjust the connectionstring section as shown below:

        <remove name="LocalSqlServer" /><add name="LocalSqlServer" connectionString="Data Source=.;Integrated Security=True;Initial Catalog=aspnetdb" />
        

    This removes the LocalSqlServer (which points to a SQLExpress instance) from the connectionstrings provided by the machine.config.
    There is no need to define the membership provider (step 5) this way.

  5. Add the membership provider settings to your system.web settings (important: connectionStringName points to the name specified in step 4):
    <membership defaultProvider="CustomizedProvider"> <providers>       
        <add name="CustomizedProvider"       
            type="System.Web.Security.SqlMembershipProvider"       
            connectionStringName="MySqlRoleManagerConnection"       
            applicationName="aex_project"       
            minRequiredPasswordLength="5"       
            minRequiredNonalphanumericCharacters="0" /> </providers>       
    </membership>    
  6. In Visual Studio go to the Project menu and choose ASP.NET Configuration. In the configuration tool change the “Authentication type” to “From the internet” (this adjusts your authentication mode in the web.config from “Windows” to “Forms”)

See also http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

Share

Client thinks TFS server is offline

The TFS client keeps track of the TFS Server status in the registry. When you try to (re)bind a solution to source control and there are no available servers; open up the registry and navigate to

HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio9.0TeamFoundationServers

The value for “Offline” should be 0; now restart visual studio and bind the solution to source control.

Share

Removing netmeeting from Windows 2003

To prevent WFP (Windows File Protection) to restore the files delete the items found in “Program FilesNetmeeting” from the folders:

%systemroot%Windowssystem32dllcache
%systemroot%WindowsServicesPacksI386

Execute the following commandline:

%systemroot%system32rundll32.exe setupapi,InstallHinfSection NetMtg.Remove 132 msnetmtg.inf

After a reboot Windows 2003 asks to delete user-settings for netmeeting; answer with Yes

Share

Creating a MOSS 2007 webpart

  1. Start VS 200[5][8] and create a new class library
  2. Sign your class library and determine the publickey token (use reflector.NET for example)
  3. Create a new class in your library with the following code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.WebControls.WebParts;
    namespace SimpleWebpart
    {
        public class SimpleWebPart : WebPart
        {
            private string displayText = "Hello World!";
    
            [WebBrowsable(true), Personalizable(true)]
            public string DisplayText
            {
                get { return displayText; }
                set { displayText = value; }
            }
    
            protected override void Render(System.Web.UI.HtmlTextWriter writer)
            {
                writer.Write(displayText);
            }
        }
    }
    
  4. Add the following line of code to your AssemblyInfo.cs:
    [assembly: AllowPartiallyTrustedCallers]
    
  5. Edit your web.config to add a safecontrol entry (remember to use the public key token as determined in step 2):
    <SafeControl Assembly="SimpleWebpart,Version=1.0.0.0,
      Culture=neutral,PublicKeyToken=XXXXXXXXXXXXXXX"
      Namespace="SimpleWebpart" TypeName="*" Safe="True" />
    
  6. Copy the class library dll to the bin directory of your webapplication
  7. Create a site collection if not already available
  8. Go to Site Actions –> All settings –> Web parts. Choose New and add your web part to the site gallery.
  9. Edit the page and add your webpart.
Share

Setting up MOSS 2007 search

  1. Create a SSP on a new web application (optional; you can assing your website to an existing SSP)
  2. Change association to use the new SSP
  3. Open the new SSP via Shared Services Administration
  4. Click User Profiles and Properties
  5. Click Full Import
  6. Go back to SSP
  7. Click Search Settings
  8. Click Content Sources and Crawl Schedules
  9. Set “Use this server for serving search queries” enabled (Operations –> Services on Server –> Office Search server”
  10. Be sure that the specified accounts have enough rights to access the websites
Share

Unable to load SharePoint page

When you have webparts on your page that are no longer available SharePoint throws an exception. To remove the webparts from the page that are no longer available navigate to the url

http://YourServer/Pages/[your page in error]?contents=1

Checkout the page; delete the webpart; and check in. Page can be loaded again!

Share

Add “After build” event in project file Visual Studio

After build events can be added to the property page of a visual studio project. You can also add your own “targets” file to the afterbuild (or beforebuild) in the project file itself. Use the following method:

  1. Add a targets file to your project with the following contents (for example)
    <?xml version="1.0" encoding="utf-8" ?>
    <Project DefaultTargets="WSPBuild"
       xmlns=http://schemas.microsoft.com/developer/msbuild/2003>
       <PropertyGroup>
          <WSPBuilderPath>"....ToolsWSPBuilder.exe"</WSPBuilderPath>
       </PropertyGroup>
       <Target Name="WSPBuild">
          <Exec Command="cd $(ProjectDir)" Outputs="null" />
          <Message Text="Executing WSP Builder in directory $(ProjectDir)"/>
          <Exec Command="$(WSPBuilderPath) "/>
       </Target>
    </Project>
    
  2. Unload the project file
  3. Right click the project file and choose Edit…..
  4. Add an import tag below the last import tag in the projectfile:
    <Import Project="wspbuilder.Targets" />
    
  5. Uncomment the AfterBuild tag and add the following statements; remember to specify the adjust CallTarget!
    <Target Name="AfterBuild">    
         <CallTarget Targets="BuildSharePointPackage" />
    </Target> 
    
Share