Saturday, June 21, 2008

Simple Theme and HTTPS

On a personal project I was doing with MOSS a few months back, I was working on using SSL with MOSS for an Internet facing MOSS site project. I had a MOSS web application with a publishing site template used on my root site collection. Everything was going great: I had SSL working on port 443 with a self-signed cert. But then I decided to use the OOB "Simple Theme" because it fit with the color scheme I was using on my master page for publishing pages.

At the point I assigned the Simple theme to my top-level site and then hit the HTTPS URL I got the warning message that Internet Explorer produces when you have mixed absolute HTTP and HTTPS URLs on the same page. The warning message reads "This page contains both secure and nonsecure items. Do you want to display the nonsecure items?". But oddly enough, when I used any other OOB theme I did not get the warning message.



For some background, an example of when this warning message is produced would be if you had an HTTPS URL such as:

https://www.myweb.com/page.aspx

Then inside page.aspx hard coded an absolute URL for an external resource such as:

<html> <body> ... <img src="http://www.myweb.com/images/image1.gif"> ... </body> </html>

When you mix absolute HTTP URLs in a page that is being hosted on web application in IIS with an HTTPS binding, web browsers get uncomfortable and throw a warning message that, to a normal user, would be rather disconcerting -- for sure something you don't want on a production web site.

So at this point I was scratching my head -- why would changing the theme to the "Simple Theme" make Internet Explorer produce this warning? I double checked the HTML source of my master page, my page layouts, my linking CSS files and everything looked good, no hard coded HTTP references.

Then it hit me, this is only happening with the Simple theme not with any other theme -- so what about the linked "theme.css" file that defines the color scheme for the Simple theme in the "12/TEMPLATE/THEMES/SIMPLE" folder. So I opened up the theme.css file in notepad and did a search for "http" and lo and behold I found two entries hardcoded for "http://localhost/[image name].gif".



Labels: ,

Hey, where's Jonathon?

So, it's been a really long time since my last post, and I apologize for any comments or emails sent to me that have not yet been replied to. A lot of really big things have happened in my life during the last six months -- the first being I've gone back to Microsoft to join their Consulting Services team (Media & Entertainment group). The second change is that I am (next week actually) moving to Los Angeles from Phoenix to join my MCS team there.

As with any change of this magnitude I've been completely busy with new projects in new cities and so it's been really quite challenging to keep up with the blog on top of my normal responsibilities. In fact, as I type this entry I am on a plane from Philadelphia, where I just finished a project, heading back home to Phoenix (well, home for seven more days that is). But I really hope going forward to stay more active on this blog, I am so happy that since I started it I've gotten so many great comments and that these posts have actually been useful for other SharePoint-ies out there :-)

I have a lot of new things to write about on MOSS since I've been working with it even more over the last six months!

Labels:

Friday, October 26, 2007

Adventures in Office SharePoint 2007 Search Thesaurus

On a recent project one of my suggestions to my client on how to help new employees joining the organization to better and more easily find content on the corporate portal was to employ the handy search thesaurus feature of SharePoint.

The search thesaurus feature is one where you can configure SharePoint search so that if one word is searched, such as “HR” it could also concurrently search the words “Human Resources” and “Talent” in the same search query. In SharePoint terms this would be an “expansion set”. You also have the option of replacing the search word so that if an end user searched for the word “Windows NT” the search could actually query some words such as “Windows” and “Windows Server” while not searching the word “Windows NT”, this is known as a “replacement set”.

This is all well and good, however I quickly found the implementation of this cool feature was more easily said than done.

After updating what I thought was the appropriate .XML file it was unclear what needed to be done to “activate” the thesaurus to take hold (IISRESET? Run a full crawl?), also, it was rather unclear which files needed to be updated and I was unsure if the .XML file I updated was the correct one.

After searching around the web and hitting that standard issue SharePoint books I became even more confused. It seemed some things worked for some individuals but not others. So now, after having a bit of a struggle, I think I got this thing “mostly” figured out and I wanted to share my findings. The following are the steps I took to get the search thesaurus feature working for me and my client.

How to configure the search thesaurus in Office SharePoint Server 2007

Step 1: Find the correct “tsxxx.xml” file

There are a number of “tsxxx.xml” files (where “xxx” is actually a three letter abbreviation of a language) such as “tsenu.xml” for American English and “tseng.xml” for British English. But there is also the “tsneu.xml” file, this is the neutral language file that will work no matter what language SharePoint is configured to be serving. It was the “tsneu.xml” file that I ended up using in the end for my project.

There are actually a couple of locations of the “tsxxx.xml” files. The one that I found that actually impacted my search results in the end is the following (if you installed SharePoint in the standard file location):

C:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\Applications\{GUID for SSP}\Config\

Although, in my client’s case we actually moved the index location to a SAN for search index growth so in that case the location of the “tsxxx.xml” files was somewhere to the effect of:

E:\Portal Search Index\12.0\Data\Office Server\Applications\{GUID for SSP}\Config\

Now, from what I read, theoretically if you update the “tsxxx.xml” files located in the folder:

C:\Program Files\Microsoft Office Servers\12.0\Data\Config

These files will at some point get copied down into the deeper (C:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\Applications\{GUID for SSP}\Config\) folder. However after much extensive testing this never worked for me.

Step 2: Verify you are working with the correct “tsxxx.xml” file

The next step is to verify you are working with the correct “tsxxx.xml” file. I just took the “tsneu.xml” file and removed the XML comments around the main nodes in the default example file to make the provided run and jog expansion set active. From there, I uploaded two simple text files: one named jog.txt and another named “run.txt” and inside each had just the word “jog” and “run” respectively. I just wanted to make the simplest example work first.

Once I did this I had to do something to make my XML changes take hold. I read that you need to do an IISRESET and also a full crawl on the content source, but in the end I found out that the only thing I had to do to make my “tsxxx.xml” file take hold was to restart the Office SharePoint Server Search service, also known as “osearch”. I actually wrote a little batch file (commands shown below) to stop and start the service because I kept trying different files over and over again in my testing.

Search Service Restart Batch File Commands:

net stop osearch
net start osearch
PAUSE

Step 3: Update the correct “tsxxx.xml” file

So this is where I really got stuck. After finally figuring out which file I needed to update and how to make it take hold, my final series of expansion sets I got back from my client were not taking hold in my search results and it was a real mystery. What I had done was provide my client with a worksheet to fill out and they really did a great job, so I had a really large number of expansion sets each with many words. Turns out this is actually what got me in trouble in the end – turns out you can’t have duplicate entries in your expansion or replacement sets. SharePoint gets horribly confused. To illustrate, consider the following XML snippet:

<expansion>
<sub>word1</sub>
<sub>word2</sub>
<sub>word3</sub>
</expansion>

<expansion>
<sub>word5</sub>
<sub>word2</sub>
<sub>word6</sub>
</expansion>

This above example would actually not work and interestingly enough, there would be no errors or indication produced by SharePoint (that I could find). The reason for this not working is because “word2” is used in both sets. This seems to be an undocumented bug of some sort. So, the big lesson here was to remove all duplicates across each expansion set. Once I did this, my results worked perfectly!

Labels:

Sunday, July 22, 2007

How to sysprep a Virtual Machine

Came across this fantastic article on how to sysprep a virtual machine:

http://blogs.technet.com/megand/articles/357570.aspx

This is really helpful because for a while now me and my team at Neudesic have been wanting to create a nice library of sysprep'ed VMs to have on hand for when we need them. I got this working as far as just sysprep'ing a Windows Server 2003 VM, but I have yet to try it with a server with WSS or MOSS installed. When I get around to this I will try to post a part II to this entry with the results (and if there are any sneaky things that need to be done to make it work right).

Labels: , ,

Set Path for stsadm.exe

I am sure this is nothing new or amazing, but another little thing that has kind of bugged me was always needing to point my command window to the SharePoint BIN folder to get at stsadm.exe to run SharePoint commands and such. Back in the day I would’ve just edited my machine's autoexec.bat and added a SET PATH command to the BIN folder so that it would always be available – but those days are long over ;-)

So after doing a little bit of searching around I figured out how to add a SET PATH in Windows Server 2003. It’s really easy...

  1. Open up the system properties window (Right Click My Computer > Properties)
  2. Click on the “Advanced” tab
  3. Click on the “Environment Variables”

  4. In the “System variables” list, find and select the item named “Path”

  5. Click "Edit"
  6. In the “Edit System Variable” window, in the “Variable value” field add a semicolon at the end as a separator and add the path to the SharePoint BIN folder:

    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\

    Note: be sure to add the semicolon “;” after the last path and before the new

  7. Hit OK in all the windows and you should be good to go. If you open up a command window and type stsadm you should be able to access it without having to go through the trouble of navigating to the SharePoint BIN folder.

Labels: ,

App Pool Recycle Command

So one thing I have been wondering for a while now was how I can just recycle an application pool used by a SharePoint web application rather than execute a full iisreset. After you deploy a feature or make any number of configuration changes you need to often times recycle the app pool used by the web application – running iisreset does this, but it also recycles every application pool and takes a solid 80% longer than just recycling a selected app pool.

Anyway, thanks to Ted Pattison in his awesome Inside WSS 3.0 book and I found this extremely helpful command:

cscript c:\windows\system32\iisapp.vbs /a "[App_Pool_Name]" /r

Note: be mindful to not forget the /r at the end :-)

Just replace [App_Pool_Name] with the name of the app pool you want to recycle and you should be all set. Also, what is nice is that you can add this line into a batch file and execute it as a post complication script in Visual Studio so that after compiling and deploying a feature the reset will go much faster than with iisreset, speed things up a bit.

Labels: , , ,

Thursday, July 19, 2007

Moved to Phoenix!

Yes, it has really been quite some time since my last post -- lots of crazy thing have happened in the last few months. I got a great new position at the Phoenix office of Neudesic, LLC a top-notch Microsoft partner based out of Irvine, CA as Principal Consultant & Regional Practice Manager of the Information Worker practice. Also, I moved down to Phoenix from Seattle which was a much bigger thing that I anticipated. But nevertheless am really happy down here with the position and the way things have turned out.

I apologize to everyone who has posted questions and comments in the last couple of months that I still haven’t responded to -- I hope going forward to be a lot more active!

Labels: , ,