Wednesday, August 27, 2014

Web Part Branding















Create css file "WebPartStyle.css" & upload in Style Library with below mentioned contents :

.ms-wpTdSpace{
display:none;
}
.ms-WPHeader td:first-child {
    background: url('g-03.png') no-repeat top right;
    background: url('g-01.png') no-repeat top left;
    margin: 0;
    padding: 0px 0px 0px 20px;;
    height: 20px;
    display:inline;
}

.ms-WPHeaderTdMenu {
    margin:0px 0px 0px 20px;
    background: transparent url('g-02.png') scroll repeat-x right top !important;

    border: 0;
}

.ms-WPTitle
{
   background: url('g-02.png') no-repeat top repeat-x !important;
}
.ms-WPTitle A {
color:white !important;
}
.ms-WPHeaderTdSelection{

    background: transparent url('g-03.png') scroll repeat-x right top !important;
}

/* border (title and border) */
.ms-rtestate-field table
{
    border-collapse: separate;
}
.ms-WPBorder
{
    border-top: none;
    border-right: 1px #C0C0C0 solid;
    border-bottom: 1px #C0C0C0 solid;
    border-left: 1px #C0C0C0 solid;
}
/* title (title and border, title only) */
.ms-WPHeader > td
{
    border-top: none;
    border-bottom: none;
}
.ms-WPHeader > td:first-child
{
    border-left: none;
}
.ms-WPHeader > td + td.ms-wpTdSpace
{
    border-right: 0px #C0C0C0 solid;
}


/* Hide
.ms-WPHeaderTdSelection{

 background: transparent url('/_layouts/images/DesignerListWebPart/topchannel.png') repeat-x  !important;
}
*/



Now edit the v4.Master page & place below given line just above this tag :  <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>


 <link rel="stylesheet" type="text/css" href="../../Style Library/WebPartStyle.css" /> "
  <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>

You can find images on One Drive.


Branding Left Navigation











Create css file "LeftNavStyle.css" & upload in Style Library with below mentioned contents :

/* To Set minum Height of the page */
.s4-ca{
 min-height:500px !important;
}

/* Remove Top Space From Left Navigation */
.ms-quickLaunch  {
padding-top:5px !important;
}

/* For Footer */
.custom-footer
{
clear:both;
text-align: center;
padding: 10px;
background-color: #FCFCFC;
border: 1px solid #DBDDDE;
}
/* Left Navigation Heading */
.s4-ql ul.root > li > .menu-item, .s4-qlheader, .s4-qlheader:visited {
   
    border-bottom:1px solid #B8BABD !important;
    border-top: 1px solid #E0E0E0 !important;
    font-size: 1.2em;
    margin: 0;
    overflow-x: hidden;
    padding: 3px 4px 3px 10px;
    word-wrap: break-word;
 background:  url('../SiteAssets/01-03.png') repeat-x;
 /*background-color:#005B96 !important;*/
 color:#fff;

}
/* Left Navigation item Hover */
.s4-ql ul.root ul > li > a:hover{
 color: #005B96 !important;
 background-color: #CCE3F2 !important;
 background: url('../SiteAssets/01-hover.png') repeat-x !important;
}

/* Left Navigation item Selected */
.s4-ql ul.root ul > li > a.selected{
color: #fff !important;
    background-color:#0072BC!important;
  background: url('../SiteAssets/01-SElect.png') repeat-x !important;
    height:15px !important;
    padding: 3px 4px 0px 10px !important;

}

/* Space from left side */
.s4-ql ul.root ul > li > a {

 margin-left:10px;
 background-position: left center;
 background-image:url('/_layouts/images/scrollbar-mousein-rightarrow.png');
 background-repeat:no-repeat;
    padding: 3px 4px 4px 10px;
}

/*Left Nav Color */
body #s4-leftpanel-content {
    border-style: solid;  
    background-color:#fff;
}


/* Top Navigation Color */
.s4-tn{
margin:0;
padding:0;
/*background-color:#0072BC!important;*/
background:  url('/_layouts/images/DesignerListWebPart/topchannel.png') repeat-x;

}

/* Hide Recycle Bin & View All site contant */
.s4-specialNavLinkList{
 display:none;
}


/*Left Nav Selected Heading
.s4-ql a.selected {
 color: #fff !important;
    background-color:#0072BC!important;
  background: url('/_layouts/images/DesignerListWebPart/jewel_select_middle.png') repeat-x !important;
    height:15px !important;
    padding: 3px 4px 0px 10px !important;

}
.s4-ql a:hover{
 color: #005B96 !important;
 background-color: #CCE3F2 !important;
 background: url('/_layouts/images/DesignerListWebPart/jewel_hover_middle.png') repeat-x !important;
}

*/
Now edit the v4.Master page & place below given line just above this tag :  <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>


 <link rel="stylesheet" type="text/css" href="../../Style Library/LeftNavStyle.css" /> "
  <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>

You can find images on One Drive.

Tuesday, August 19, 2014

Prompting continuously for credential after setting Alternate Access Mapping


I have created a web application in SharePoint & also set the “Alternate Access Mapping” for the web application like:



Zone

URL

Host Header in IIS

Default


sharepoint2010

Intranet

http://sharepoint2010.mydomain.com

sharepoint2010.mydomain.com

Internet



Custom

 

 

Extranet

 

 

 

When I login to http://www.mysharepoint2010.com, it allow me to login. But just after this login, I won’t be able to use my default url (http://sharepoint2010). It prompts me for credentials so many times & won’t allow me to login to the url http://sharepoint2010.

When I reset my iis then it allow me to login to http://sharepoint2010. But when again I login to http://www.mysharepoint2010.comand then again I want to use url http://sharepoint2010. It won’t allow me to use this url.

I have done some R & D and found that SharePoint uses Session-Based-Authentication and default claim token has 10 hours life time.

This cached token is used for all subsequent requests. So the end user will not really be able to access the site until next day.

You can see the default time by using this power shell command:



PS C:\Users\gaurav> $sts = Get-SPSecurityTokenServiceConfig

 

PS C:\Users\gaurav> $sts.WindowsTokenLifetime

 

 

Days              : 0

Hours             : 10

Minutes           : 0

Seconds           : 0

Milliseconds      : 0

Ticks             : 360000000000

TotalDays         : 0.416666666666667

TotalHours        : 10

TotalMinutes      : 600

TotalSeconds      : 36000

TotalMilliseconds : 36000000

 

 

 

PS C:\Users\gaurav> $sts.FormsTokenLifetime

 

 

Days              : 0

Hours             : 10

Minutes           : 0

Seconds           : 0

Milliseconds      : 0

Ticks             : 360000000000

TotalDays         : 0.416666666666667

TotalHours        : 10

TotalMinutes      : 600

TotalSeconds      : 36000

TotalMilliseconds : 36000000

 

When I set this 10 hours to 1 minute, It works for me. Now I can login to url http://www.mysharepoint2010.comand then I am able to use the default url http://sharepoint2010as well.

Here is the powershell command :



$sts = Get-SPSecurityTokenServiceConfig


$sts.WindowsTokenLifetime = (New-TimeSpan –minutes 1)

$sts.FormsTokenLifetime = (New-TimeSpan -minutes 1)

$sts.Update()

Iisreset
 


 

Here is output :



PS C:\Users\gaurav> $sts = Get-SPSecurityTokenServiceConfig

 

PS C:\Users\gaurav> $sts.WindowsTokenLifetime

 

 

Days              : 0

Hours             : 0

Minutes           : 1

Seconds           : 0

Milliseconds      : 0

Ticks             : 600000000

TotalDays         : 0.000694444444444444

TotalHours        : 0.0166666666666667

TotalMinutes      : 1

TotalSeconds      : 60

TotalMilliseconds : 60000

 

 

 

PS C:\Users\gaurav> $sts.FormsTokenLifetime

 

 

Days              : 0

Hours             : 0

Minutes           : 1

Seconds           : 0

Milliseconds      : 0

Ticks             : 600000000

TotalDays         : 0.000694444444444444

TotalHours        : 0.0166666666666667

TotalMinutes      : 1

TotalSeconds      : 60

TotalMilliseconds : 60000


Here I am setting 1 minute life for token.