Reminder: The following web.config file exists and must be updated for debugging purposes:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config
<configuration>
<system.web>
<customerrors mode="Off">
</system.web>
</configuration>
Thursday, November 10, 2011
Using URL Rewrite to Redirect
The following is performed at the web site level in IIS. See 'Resources' below for the 'URL Rewrite' download link, the user reference guide, and a couple other helpful links.
Match URL > Requested URL: 'Matches the Pattern' > Using: 'Regular Expressions' > Pattern:
*Note: Pattern: tests against the <path>, not the entire URL!
http(s)://<host>:<port>/<path>?<querystring>
So if you want to test if a string is in the beggining of the path, you would use ^. For example, if you want to redirect...
http://intranet.samplecompany.com/hr/Pages/default.aspx
... to ...
http://intranet.samplecompany.com/teams/hr/Pages/default.aspx
... you would use:
Pattern: ^hr/.*
Then, Action > Action type: 'Redirect' > Action Properties > Redirect URL:
http://intranet.samplecompany.com/teams/{R:0}
The {R:0} is a back reference variable. You can see it when you use the 'Test pattern...' button in the 'Match URL' section of the form.
*Tip: When using the 'Test pattern...' button > Input data to test:
Use the path, not the entire URL! Remember, the pattern tests against the path, not the entire URL!
*Note: It seems that when using 'Conditions', the path needs a leading forward slash. So for the 'Redirect URL' with no Conditions, one would use the pattern...
^hr/.*
... and the 'Redirect URL'...
http://intranet.samplecompany.com/teams/{R:0}
... but with Conditions, one would use the Condition pattern...
^/hr/.*
... and the 'Redirect URL'...
http://intranet.samplecompany.com/teams{C:0}
*Another Note:
If you attempt to browse to a non-existent page, you will get a 404 error. This is by design, because if the following link doesn't exist here...
http://intranet.samplecompany.com/hr/Pages/sample.aspx
... it's not going to exist here either...
http://intranet.samplecompany.com/teams/hr/Pages/sample.aspx
Resources:
Match URL > Requested URL: 'Matches the Pattern' > Using: 'Regular Expressions' > Pattern:
*Note: Pattern: tests against the <path>, not the entire URL!
http(s)://<host>:<port>/<path>?<querystring>
So if you want to test if a string is in the beggining of the path, you would use ^. For example, if you want to redirect...
http://intranet.samplecompany.com/hr/Pages/default.aspx
... to ...
http://intranet.samplecompany.com/teams/hr/Pages/default.aspx
... you would use:
Pattern: ^hr/.*
Then, Action > Action type: 'Redirect' > Action Properties > Redirect URL:
http://intranet.samplecompany.com/teams/{R:0}
The {R:0} is a back reference variable. You can see it when you use the 'Test pattern...' button in the 'Match URL' section of the form.
*Tip: When using the 'Test pattern...' button > Input data to test:
Use the path, not the entire URL! Remember, the pattern tests against the path, not the entire URL!
*Note: It seems that when using 'Conditions', the path needs a leading forward slash. So for the 'Redirect URL' with no Conditions, one would use the pattern...
^hr/.*
... and the 'Redirect URL'...
http://intranet.samplecompany.com/teams/{R:0}
... but with Conditions, one would use the Condition pattern...
^/hr/.*
... and the 'Redirect URL'...
http://intranet.samplecompany.com/teams{C:0}
*Another Note:
If you attempt to browse to a non-existent page, you will get a 404 error. This is by design, because if the following link doesn't exist here...
http://intranet.samplecompany.com/hr/Pages/sample.aspx
... it's not going to exist here either...
http://intranet.samplecompany.com/teams/hr/Pages/sample.aspx
Resources:
Tuesday, November 8, 2011
CQWP - Date Example
ItemStyle.xsl <xsl:template>
<xsl:value-of select="ddwrt:FormatDateTime(string(@PublicationDate),1033,'MM.dd.yyyy')"></xsl:value-of>
Make sure to include the following in the <xsl:stylesheet> tag:
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
<xsl:value-of select="ddwrt:FormatDateTime(string(@PublicationDate),1033,'MM.dd.yyyy')"></xsl:value-of>
Make sure to include the following in the <xsl:stylesheet> tag:
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
Friday, November 4, 2011
Edit in Notepad
- Open C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\DOCICON.XML
- <Mapping Key="txt" Value="ictxt.gif" EditText="Notepad" OpenControl="SharePoint.OpenDocuments"/>
- Reset IIS
Thursday, September 29, 2011
.NET - Select a ListItem
sampleDropDownList.ClearSelection();
ListItem sampleListItem = sampleDropDownList.Items.FindByValue(sampleValue);
if (sampleListItem != null)
{
sampleListItem.Selected = true;
}
ListItem sampleListItem = sampleDropDownList.Items.FindByValue(sampleValue);
if (sampleListItem != null)
{
sampleListItem.Selected = true;
}
SQL Server - Change Result Set Size
Tools > Options... > SQL Server Object Explorer > Commands > Table and View Options > Value for Edit Top <n> Rows command > 300
Friday, September 2, 2011
The trust relationship between this workstation and the primary domain failed
Disconnect network connection > Log in with domain credentials > Reconnect network connection.
Subscribe to:
Comments (Atom)