- Determine the identity of your ASP.NET application. In most situations this will be the “NT AUTHORITYNETWORK SERVICE” account.
- Grant the account determined in step 1 access to the machine-level RSA key container:
aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITYNETWORK SERVICE"
- To encrypt your appSettings section execute the following command:
aspnet_regiis -pe "appSettings" -app "/Site"
appSettings is casesensitive and /Site point to the virtual folder where your web.config is stored. - To decrypt the web.config section execute the following command:
aspnet_regiis–pd "appSettings" –app "/Site"
- Retrieving your encrypted settings can be done with the ConfigurationManager:
string username = ConfigurationManager.AppSettings["username"].ToString();
Author Archives: Berend de Jong
Configure WCF logging
To configure WCF logging you can use the standard tools provided by Microsoft. This posting describes how to configure your client to log the messages it sends to a service.
Continue reading
Configure ASP.NET role provider
- Run “aspnet_regsql.exe” from c:windowsmicrosoft.netframeworkv2.0.50727
- 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)
- Select in the databse aspnetdb the role “aspnet_membership_Fullaccess; right click and add the Network Service account to this role
- 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. - 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>
- 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
.NET Security
.NET Security is a complicated (and sometimes frustrating) subject. Check this link for a very good tutorial about .NET secuirty.
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.
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
Creating a MOSS 2007 webpart
- Start VS 200[5][8] and create a new class library
- Sign your class library and determine the publickey token (use reflector.NET for example)
- 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); } } }
- Add the following line of code to your AssemblyInfo.cs:
[assembly: AllowPartiallyTrustedCallers]
- 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" />
- Copy the class library dll to the bin directory of your webapplication
- Create a site collection if not already available
- Go to Site Actions –> All settings –> Web parts. Choose New and add your web part to the site gallery.
- Edit the page and add your webpart.
Setting up MOSS 2007 search
- Create a SSP on a new web application (optional; you can assing your website to an existing SSP)
- Change association to use the new SSP
- Open the new SSP via Shared Services Administration
- Click User Profiles and Properties
- Click Full Import
- Go back to SSP
- Click Search Settings
- Click Content Sources and Crawl Schedules
- Set “Use this server for serving search queries” enabled (Operations –> Services on Server –> Office Search server”
- Be sure that the specified accounts have enough rights to access the websites
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!