Subscribe to my RSS Feed by selecting the orange image (left) or selecting the links at the bottom of the page.
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 27 July 2008 01:18
in the ASP.NET category
Generate Local Resource - Missing/Greyed out
For some reason my "Generate Local Resource" disappeared from the Tools menu in Visual Studio 2008.
To correct this follow these steps:
- Go to Tools > Customise > Commands Tab
- Select the Tools Category on the left
- Rearrange Commands > Select the "Add..." button
- Select the "Tools" option on the left (in Categoris list box)
- Under commands select "Generate Local Resource"
- Select the Ok button then close the remaining windows.
After adding the command back to the tools menu, it appeared Greyed out. If you open an ASPX page and select Designer Mode, it will become active!
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 23 March 2008 09:54
in the General category
New smarter re-write!
DavidKiff.co.uk has undergone a radical new re-write so it’s now easier to update and runs on a sturdy SQL Server backend rather than the old Access one!
I hope you like the new look!
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 17 February 2008 06:31
in the WCF category
WCF Open Service Host Error
WCF "Your process does not have access rights to this namespace"
This is the error message I received when starting a WCF service in windows vista. The problem is down to Vista security restrictions (UAC) not allowing applications to open ports (start listening on a port.
There are a few ways to resolve this issue:
- Run the WCF host with administrative rights (not recommended) by right clicking your .exe and selecting “run as administrator”.
- Use netsh.exe to allow a user to start listening on the port(s) you specify:
“netsh http add urlacl url=http://+:8080/ user=COMPUTERNAME\USERNAME”
This example allows the username specified to start listening on port 8080 with any IP address or hostname.
To find a list of commands run “netsh http”.
Domain Users: Replace “COMPUTERNAME” with the name of your domain.
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 01 August 2007 01:18
in the ASP.NET category
Global.asax Session_Start Not Fireing
I have spent an hour trying to work out why the session start was not fireing within my global.asax file! It turns out that I was adding it to a pre-complied application!
Dont make my mistake!
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 08 July 2007 02:41
in the ASP.NET category
Custom Crumbline based on URL
A few people have asked me how to create a crumbline based on the URL, for example:
www.mydomain.com/Hello_World/MyPage.aspx
www.mydomain.com/DotNet/Examples/FirstExample.aspx
The first one should display:
Home > Hello_World > MyPage.aspx
Second should display:
Home > DotNet > Examples > FirstExample.aspx
Here is a method for doing so:
private string CreateCrumb()
{
string[] pathNames = Request.RawUrl.Split(‘/’);
System.Text.StringBuilder crumbLine = new System.Text.StringBuilder();
for (int i = 1; i < pathNames.Length; i++)
{
crumbLine.Append(pathNames.GetValue(i));
if (i != pathNames.Length - 1)
{
crumbLine.Append(" > ");
}
}
return crumbLine.ToString();
}
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 03 May 2007 02:44
in the Platforms category
Disabling “Low Disk Space in Vista”
- Right- click within the system tray (near the clock)
- Select properties from the context menu
- Check the “Hide inactive icons” checkbox
- Select the “Customise” button
- Under “Low Disk Space” select “Hide” for the behavior
- Select Ok and you are done. No more alloying messages!
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 30 April 2007 11:06
in the Sharepoint category
Creating SharePoint 2007 Themes
- Navigate to:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES
- Copy and paste a complete theme
- Rename the theme
- Navigate inside the theme directory
- Rename the .inf file to the exact name of the directory
- Open the .inf file in Microsoft Notepad
- Find and replace the old theme name with the new theme name created
- Create a new image to represent the new theme
- Navigate to:C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES
- Add the new image to the directory and record the filename
- Navigate to:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
- Open the file “SPTHEMES.XML” in notepad
- Copy and paste an entire Template
- Rename “TemplateID” to the name of the directory previously created
- Write an appropriate display name and description
- Enter the location of the image (images/recordedFilename) created in step 10 under the thumbnail and preview entities
Applying the Theme
- Open the SharePoint site
- Navigate to “Site Actions”
- Select “Site Settings” then “Modify All Site Settings”
- Under “Look and Feel” select “Site Theme”
- Select the new theme from the list and select “Apply”
Modifying the Theme
Tools such as the CSS Viewer in Mozilla FireFox will prove to be valuable in locating classes.
- Ensure the theme is applied
- Open the site in Microsoft SharePoint Designer
- Navigate to “_Themes” then the new theme folder created earlier
- Open the .CSS file ending in 65001.CSS
- Modify this file to change the theme
- To change the images navigate to the themes directory:C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES\BROADRIDGE
- Select an appropriate image and modify as required.
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 15 January 2007 04:12
in the Networking category
Problem with ARP Cache
My Windows 2003 virtual server would not allow me to repair a connection, I recieved the error "Problem clearing ARP Cache". Most forums suggest to type the following at the command prompt:
"netsh interface ip delete arpcache"
... however no luck.
I eventually found the problem- "Routing and Remote Access" service needed to be stopped. Here is the fix:
- Click the < Start> button
- Click the < Control Panel> button
- Switch to "Classic View" if you are in "Category View"
- Click < Administrative Tools>
- Click < Computer Management>
- Double-click < Services and Applications>
- Double-click < Services>
- Scroll down to < Routing and Remote Access>
- Double-click < Routing and Remote Access>
- Examine the "Start-up Type" (The options are "Automatic", "Manual", and "Disabled")
- Set the "Start-up Type" to "Disabled"
- Click the < OK> button
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 13 January 2007 10:27
in the Visual Studio category
Visual Studio 2005 SP1 for Vista
Whilst trying to install Visual Studio 2005 Service Pack 1 for Vista I recieved the following message:
"The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer..."
What I didnt realise was that I must install Visual Studio 2005 SP1 first!
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 07 January 2007 04:24
in the Platforms category
Windows Vista
Vista... over three days I spent trying to install this before Christmas. Each install took around 30-50 hours :(! Very frustrating when i find out it fails each time, with no noticable errors. This install was different, i HUNTED for SATA drivers, all I could get is a .exe from intel- no use to load as a driver for vista:(
Finally i found out what files were requried and searched my pc for them, when found I loaded them and vista installed in under 30mins! Wow!- not one problem.
The files I used were:
- iaahci.inf
- iaAHCI.cat
- iaStor.sys
- iaahci.pnf
Im sure the files will be different depending on your chipset and system. Mine is:
Intel 925 Chipset (Dell Dimension 8400) Intel Pentium 4 3.40 GHz 2046 MB RAM
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 06 January 2007 04:16
in the Applications category
Word 2007 line spacing problems
Word 2007 pre-defines a huge line space! This really started to annoy me, as my work seems to spaced out. To correct this issue and have the line spacing the same as previous Word follow the below steps:
- Select the "Home" tab on the ribbon.
- Under the paragraph section select the line spacing button (figure 1.1).
- Select "Line Spacing options...".
- Select the "Indents and Spacing" tab (default selected).
- Under the "Spacing" heading select type "0pt" in for "After:" (figure 1.2).
- Select "Ok" and your finished.
|
|
|
Figure 1.1
|
Figure 1.2
|
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 04 January 2007 02:51
in the Applications category
Microsoft Office 2007
Office 2007! It takes a little getting used to as all the drop down menus have disappeared and we have a more modern easier to use "panel" across the top of the page.
In Word, the default font has changed from Times New Roman to "Calibri" which has a better look than the predecessor, and there is better use of Styles.
Excel can apply some handy formatting to imported data, making it easier to read and understand- prints out well too!
Overall very impressed! Well done Microsoft!
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 23 December 2006 04:39
in the .NET category
Appending to the begining of a text file
To add a header row to a CSV file I needed to append to the beginining of the text file, this however is not possible, instead I had to create a new file and write the original files contents to it after the header has been written:
StreamReader reader = new StreamReader(File.Open("Original.csv", FileMode.Open, FileAccess.Read));
StreamWriter writer = new StreamWriter(File.Create("Newfile.csv"));
writer.WriteLine("StudentID, Username, Forename, Surname"); //Write header row.
writer.WriteLine(reader.ReadToEnd()); //Write original file to the new one.
writer.Flush();
writer.Close();
reader.Close();
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 16 December 2006 07:28
in the ASP.NET category
Active Directory and ASP.NET Forms
My Final Year Project requires Active Directory Authentication, ASP.NET has a
very simple GUI to set this up although I have used LDAP to create finer grained
code- more customisable :D. Here is the method I have used:
public bool IsAuthenticated(string domain, string username, string pwd)
{
string domainAndUsername = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry(_path,
domainAndUsername, pwd);
try
{
// Bind to the native AdsObject to force
authentication.
Object obj = entry.NativeObject;
DirectorySearcher search = new
DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" +
username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result) { return false; }
// Update the new path to the user in the
directory
_path = result.Path;
_filterAttribute =
(String)result.Properties["cn"][0];
}
catch
{
throw
}
return true;
}
If you want to create a simpler AD login we can use the ASP.NET Login control
with Memberships. Example memberships code for the web.config file:
<membership defaultProvider="ADMembershipProvider">
<providers>
<clear/>
<add name="ADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ActiveDirectory" connectionUsername="userName"
connectionPassword="password" attributeMapUsername="sAMAccountName"
enableSearchMethods="true" requiresUniqueEmail="true"/>
</providers>
</membership>
The Login Control can utilize the membership:
<asp:Login
ID="LoginControl"
runat="server"
EnableTheming="true"
DisplayRememberMe="true"
FailureText="Login attempt has failed.">
</asp:Login>
To me it seems more beneficial to use the first option, the membership way is
easier although you require administraton rights for the connection.
Posted by David Kiff (RSS@Davidkiff.co.uk)
on 14 December 2006 04:27
in the General category
New RSS Feeds
DavidKiff.co.uk now has Live RSS feeds!