Strange TSWA connection issue if the server name contains an underscore character

UPDATE: Here’s the KB article that covers this:


Recently, one of our customers reported a strange issue that occurs with TSWA 2008. Although everything is configured correctly and running fine, it’s not possible to connect to TSWA using Internet Explorer if the server name contains an underscore (“_”) character. One of our MVPs, Neno Loje, reported a similar issue a while ago, so I’m writing this blog post to explain what’s going on.


1. When you go to the TSWA website, Internet Explorer displays an error saying “Internet Explorer cannot display this web page”. The error details might indicate a possible DNS or an authentication issue.

FAILS: TSWA on http://server_name:8090, TFS on http://server_name:8080

2. Connecting to TSWA using the IP address, but using the server name to connect from TSWA to TFS causes the following error message to be displayed on TSWA login form:

“The request failed with HTTP status 405: Method Not Allowed.”

FAILS: TSWA on http://<IP Address>:8090, TFS on http://server_name:8080

3. If the IP addresses are used instead of the server names when connecting to both TSWA and TFS, everything works fine. In some cases, using a browser different than Internet Explorer might work fine using server names.

WORKS FINE: TSWA on http://<IP Address>:8090, TFS on http://<IP Address>:8080

4. Analyzing the network traffic between the browser and TSWA website shows that the browser is being redirected continuously between login.aspx and index.aspx until it gives up. The same behavior can also be observed by looking at the TSWA log files, which looks similar to:

... Creating TeamFoundation Server...
... TeamFoundation Server Successfully Created.
... Creating WorkItemStore...
... WorkItemStore Successfully created.
... Response is redirected to /index.aspx?pname=Project1.
... Session Started
... Response is redirected to /UI/Pages/Login.aspx?redirect=%2findex.aspx%3fpname%3dProject1.
... Session Started
... Creating TeamFoundation Server..


Underscore (“_”) is not a valid character for URLs according to the RFCs. (This is why you cannot register a domain name with an underscore).

When you use Internet Explorer against a web site that uses session cookies (such as TSWA), a valid session cannot be established due to a security feature in Internet Explorer cookie handler if the server URL contains underscore characters.



Ideally, don’t use underscore characters in your server names. This issue is not specific to TSWA, and you might end up with similar issues with different web applications that depend on session states.



For a quick workaround, you can connect to TSWA using the IP address. You may also want to change the default TFS server entry in TSWA web.config to use the IP address of your TFS, or to “localhost” if TSWA and TFS is on the same machine.

For the longer term solution, you should consider to:

  • Change the name of your server to something else that doesn’t contain an underscore.
  • Create a DNS alias for your server that resolves to the same IP address, and use that name to connect to TSWA and TFS.


Contact me if you have any questions or feedback.