Thursday, December 26, 2013

How to change existing SharePoint web application port number


Sometimes we need to change port number of already existing web application in SharePoint.

Here i wanna show how to change port number for existing web application in SharePoint.

Here is my web application with port number 7476 and i want to change this to port number 7479.


and also we can see site in IIS


1. Open SharePoint central administration --> Manage web applications.



2. Now select web application for which you want to change port number.



3. Now Click the small arrow of delete button from ribbon and it will open a menu and choose "Remove SharePoint from IIS web site".



4. It will popup a dialog box in that choose 'Yes' for delete iis web sites.



5. Once the operation is over then go to your IIS manager, you will not find the site now.



6. Now we need to re-add our site with the new port number.
Now go to central administration -> Manage web applications and select your web application and click on Extend button on context ribbon.



7. It will popup dialog box in that Choose "Create a new IIS Web Site" and give new port number and click on OK.



8. Now you can check site and its port number in IIS.


 and also access your web site with the new port number.



Error Type: Custom FBA Login Page Error - Could not load file or assembly Microsoft.SharePoint.IdentityModel


In my previous post creating custom login page, i have faced that following error.

Exception message: Could not load file or assembly ‘Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. The system cannot find the file specified.

Here is the solution.

The resolution to this issue was missing a dependent assembly. So open your SharePoint site’s web.config and add the following lines within <assemblyBinding> tag:

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SharePoint.IdentityModel" publicKeyToken="71e9bce111e9429c" culture="neutral" />
        <bindingRedirect oldVersion="14.0.0.0" newVersion="15.0.0.0" />
      </dependentAssembly>


Thursday, December 12, 2013

Custom sign-in page in SharePoint 2013



Open Visual Studio 2012 -->Create a new SharePoint 2012 project using the Empty SharePoint Project" template.





Choose Farm Solution (We are going to deploy files to the SharePoint root, also known as the 15 hive, so we cannot use the sandbox here)





Add SharePoint "Layouts" Mapped Folder to the project.




Here am going to use JavaScript files, So am going to add those file in a folder to Mapped Folder.

i will add new folder to mapped folder and named it as "JS".




Now i copy my .js files to this "JS" folder.




Now i will add a new item to "UKReddyCustomLogin" inside mapped folder.  Choose to use the Application Page template and name the new page as Login.aspx.







Now i have designed my custom login page and here is the code.

**************************************************************************

<%@ Page Language="C#" MasterPageFile="~/_layouts/simple.master" AutoEventWireup="true" Inherits="UKReddyCustomLogin.Layouts.UKReddyCustomLogin.Login,UKReddyCustomLogin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d8d5b1d61efe1651" %>
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">


 <script language="javascript" type="text/javascript" src="/_layouts/15/UKReddyCustomLogin/JS/jquery.min.js" ></script>
 <script language="javascript" type="text/javascript" src="/_layouts/15/UKReddyCustomLogin/JS/jquery.corner.js" ></script>

 <script language="javascript" type="text/javascript" >

     $(document).ready(function () {
         //Hidding unnecessary elements from masterpage
         $('#s4-simple-card').attr("id", "s4-simple-card2");
         $('#s4-simple-header').hide();
         $('#s4-simple-card-top').hide();
         $('#s4-simple-card-content').css("margin", "0px");
         $('.s4-simple-iconcont').hide();
         $('#s4-simple-content').css("margin", "0px");
         $('#s4-simple-content h1:first').hide();
         $('.s4-die').hide();
         //-------------------

         //Round corners of the div
         $('.rounded').corner("10px");
     });
 </script>

 <style type="text/css">

 html, body {height:100%; margin:0; padding:0;}

 #page-background {position:fixed; top:0; left:0; width:100%; height:100%;}

 #content {position:relative; z-index:1; padding:10px;}

 </style>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">


 <SharePoint:EncodedLiteral ID="ClaimsFormsPageTitle" runat="server" text="<%$Resources:wss,login_pagetitle%>" EncodeMethod='HtmlEncode'/>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">


 <SharePoint:EncodedLiteral ID="ClaimsFormsPageTitleInTitleArea" runat="server" text="<%$Resources:wss,login_pagetitle%>" EncodeMethod='HtmlEncode'/>

</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderId="PlaceHolderSiteName" runat="server"/>

<asp:Content ID="Content5" ContentPlaceHolderId="PlaceHolderMain" runat="server">

 <center>

 <div id="content" class="rounded" style="width: 300px; height: auto; margin-top: 15%; background:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000); zoom: 1;">

 <div style=" width: 100%; height: 100px">
 <br />
 <img src='/_layouts/images/nivista.png' alt='' />
 </div>
<br>
<div style="width: 100%; height: 30px"></div>
 <asp:Login ID="signInControl" style="width: 330px" FailureText="<%$Resources:wss,login_pageFailureText%>" MembershipProvider="FBAMembershipProvider"
 runat="server" DisplayRememberMe="true" TextBoxStyle-Width="300px" RememberMeSet="true" LoginButtonStyle-CssClass="ms-buttonheightwidth" UserNameLabelText="User name" TextLayout="TextOnTop" PasswordLabelText="Password" LabelStyle-Font-Bold="false" LabelStyle-Font-Size="Large" LabelStyle-ForeColor="red" LabelStyle-Font-Names="Calibri" LabelStyle-CssClass="ms-standardheader ms-inputformheader" TextBoxStyle-CssClass="ms-input" CheckBoxStyle-Font-Bold="false" CheckBoxStyle-Font-Names="Calibri" CheckBoxStyle-ForeColor="Blue" CheckBoxStyle-CssClass="ms-standardheader ms-inputformheader" CheckBoxStyle-Font-Size="Large" FailureTextStyle-Wrap="true" FailureTextStyle-Font-Names="Calibri" FailureTextStyle-Font-Size="Small" LoginButtonStyle-Font-Names="Calibri" LoginButtonStyle-Font-Size="Large" LoginButtonImageUrl="/_layouts/images/login2.png" LoginButtonType="Image" TitleText="" TitleTextStyle-ForeColor="White" TitleTextStyle-Font-Bold="true" TitleTextStyle-Wrap="true" TitleTextStyle-Font-Names="Calibri" TitleTextStyle-Font-Size="Larger" />


 <asp:LinkButton ID="lbInternalUsers" Text="Admin Login" runat="server" Font-Names="Calibri" Font-Size="Small" CssClass="ms-standardheader ms-inputformheader" Font-Bold="true" ForeColor="Blue" OnClick="lbInternalUsers_OnClick" />


 <asp:Label ID="lblError" runat="server" Font-Bold="true" ForeColor="Red" EnableViewState="false"></asp:Label>
 </div>
 </center>


 <SharePoint:EncodedLiteral runat="server" EncodeMethod="HtmlEncode" ID="ClaimsFormsPageMessage" Visible="false" />

</asp:Content>

************************************************************************

Now add the below dll reference to the project.

"Microsoft.SharePoint.IdentityModel.dll" if you didnt find dll, please check it here.

Now change inheritance class to FormsSignInPage.

Now Replace the following code to Login.aspx.cs file.

****************************************************************************
protected void Page_Load(object sender, EventArgs e)
        {
        }
****************************************************************************
with this code

*****************************************************************************
        protected Label lblError;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            try
            {
                base.OnLoad(e);
            }
            catch { }
        }

        protected void lbInternalUsers_OnClick(object sender, EventArgs e)
        {
            try
            {
                if (null != SPContext.Current && null != SPContext.Current.Site)
                {
                    SPIisSettings iisSettings = SPContext.Current.Site.WebApplication.IisSettings[SPUrlZone.Default];
                    if (null != iisSettings && iisSettings.UseWindowsClaimsAuthenticationProvider)
                    {
                        SPAuthenticationProvider provider = iisSettings.WindowsClaimsAuthenticationProvider;
                        Redirect(provider);
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }

        private void Redirect(SPAuthenticationProvider provider)
        {
            string comp = HttpContext.Current.Request.Url.GetComponents(UriComponents.Query, UriFormat.SafeUnescaped);
            string url = provider.AuthenticationRedirectionUrl.ToString();
            if (provider is SPWindowsAuthenticationProvider)
            {
                comp = EnsureUrl(comp, true);
            }

            SPUtility.Redirect(url, SPRedirectFlags.Default, this.Context, comp);
        }

        private string EnsureUrl(string url, bool urlIsQueryStringOnly)
        {
            if (!url.Contains("ReturnUrl="))
            {
                if (urlIsQueryStringOnly)
                {
                    url = url + (string.IsNullOrEmpty(url) ? "" : "&");
                }
                else
                {
                    url = url + ((url.IndexOf('?') == -1) ? "?" : "&");
                }
                url = url + "ReturnUrl=";
            }
            return url;
        }
*****************************************************************************
Now build the project and deploy it.



Now we will use this custom login page.

Open SharePoint Central Administration -> Application Management -> Manage Web Applications.

Click the Web Application you want the authentication model and select the Authentication Providers button from ribbon.

Click the Zone you want to change the login page.

Check "Enable Forms Based Authentication (FBA)". Enter the ASP.Net Membership Provider Name and ASP.NET Role Provider Name that you configured in the web.config. For this example we used "FBAMembershipProvider" and "FBARoleProvider" (Without the quotation marks).Also, for this example we left "Enable Windows Authentication" checked. This allows us to login either via Windows Authentication or Forms Based Authentication (SharePoint will prompt you when you login for which method you'd like to use).




Now specify the sign-in page in custom sign-in page.




Now browse your site.



It is very simple design created by me.

Here source code and here reference another one here.

How to configure FBA in SharePoint 2013



Here we are going to do the following list of things:
I. Create membership provider database.
II. Setup database Permissions.
III. Create membership User/Roles.
IV. Configuring membership provider.
V. Configuring FBA for a website in Central Administration.
VI. Login using membership user.

I. Create membership provider database

The first step is to create the database using the ASP.net SQL server setup wizard. Install the new database on the database server hosting the other SharePoint databases for this app. The wizard can be accessed from the following command from the run menu.

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe

This wizard will guide you through the creation of the new SQL database.

 A welcome screen will appear. Click Next.




Select "Configure SQL Server for application services" and click Next.




Enter the name of your server and your authentication information.  In this case SQL Server is installed on the same server as SharePoint 2013 and I am logged in as an administrator and have full access to SQL Server, so I choose Windows Authentication. For the database name, I just leave it as <default>, which creates a database called "aspnetdb". Unless you want a specific name for your FBA database.




A Confirm Your Settings screen will appear. Click Next.




A "database has been created or modified" screen will appear. Click finish and the wizard will close.




II. Setup database Permissions

Now that the database has been created, we'll have to give SharePoint permissions to read and write to it. We're going to connect to the database with Windows Authentication, so we're going to have to give those permissions to the service account that is being used to run SharePoint. First, let's find out the service account that's being used to run SharePoint. Open IIS, go to "Application Pools". Take a look at the "Identity" that is being used to run the SharePoint application pools.




Now that we know what account is being used to run SharePoint, we can assign it the appropriate permissions to the membership database we created.  Open up SQL Server Management Studio and log in as an administrator.

Under Security/Logins find the user that SharePoint runs as.  Assuming this is the same database server that SharePoint was installed on, the user should already exist. Right click on the user and click ‘Properties'

Go to the "User Mapping" Page. Check the "Map" checkbox for the aspnetdb database. With the aspnetdb database selected, check the "db_owner" role membership and click OK. This user should now have full permissions to read and write to the aspnetdb membership database.




III. Create membership User/Roles

There are different ways to create aspnet users.

here am using one tool for create aspnet users, can download from here.

Once download the file unzip it and open "MembershipSeeder.exe" xml file and change server name ,database name then save the file and open "MembershipSeeder" application file and create users.

here the application interface for creation of users,roles.




Here am creating single user so selected "Only create or delete 1 user; dont use the # of Users field" check box. Then click on Create button.(other fields remains same);


IV. Configuring membership provider

The next thing that has to be done to get forms based authentication working with SharePoint is setting up the membership provider.  A membership provider is an interface from the program to the credential store.  This allows the same program to work against many different methods of storing credentials.

SharePoint is actually divided up into several web applications – Central Administration, the Security Token Service and all of the SharePoint web applications that you create. Each of those web applications needs to know about the membership provider.

SharePoint is actually divided up into several web applications – Central Administration, the Security Token Service and all of the SharePoint web applications that you create. Each of those web applications needs to know about the membership provider. i like to change this in machine.config because, By adding it to the machine.config, the configuration is inherited by all of the web.config files on the machine – so you only have to make the changes once, and don't have to remember to make the changes every time you create a new SharePoint web application.

If you don't have access to the machine.config, or prefer not to edit it, you will have to make all of these changes to the following web.config files:

1. SharePoint Central Administration

2. SecurityTokenServiceApplication

3. Every SharePoint web application you create that you would like to access via FBA.

Here we go with machine.config,

Navigate to "C:\Windows\Microsoft.Net\Framework64\v4.0.30319\Config" and open "machine.config".



In the <ConnectionString> section, add the following line:
<add connectionString="Server=<ServerName>;Database=aspnetdb;Integrated Security=true" name="FBADB" />

In the <membership><providers> section add the following:

<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
<add name="FBAMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="FBADB"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="false" applicationName="/"
requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />

In the <roleManager><providers> section add the following:

<add name="FBARoleProvider" connectionStringName="FBADB" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

Now,Save and close the machine.config file.

The SharePoint Web Services configuration overrides the machine.config and clears the entries we created. For that reason, the membership and role providers also need to be added to the SecurityTokenService First we need to find the web.config for the SecurityTokenService.

Open up IIS. Under sites, SharePoint Web Services, right click on SecurityTokenServiceApplication and click on Explore. Edit the web.config in the folder that opens.




Add the following to the web.config, just before the closing </configuration> tag:

<system.web>
<membership>
<providers>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
<add name="FBAMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="FBADB"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="false" applicationName="/"
requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />

</providers>
</membership>
<roleManager>
<providers>
<add name="FBARoleProvider" connectionStringName="FBADB" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>
</roleManager>
</system.web>

Now that the membership and role provider have been configured, we can configure SharePoint to use them.

V. Configuring FBA for a website in Central Administration

Configure SharePoint to use new membership provider

Open SharePoint Central Administration -> Application Management -> Manage Web Applications.

Click the Web Application you want the authentication model and select the Authentication Providers button from ribbon.




Click the Zone you want to change the membership provider.




Check "Enable Forms Based Authentication (FBA)". Enter the ASP.Net Membership Provider Name and ASP.NET Role Provider Name that you configured in the web.config. For this example we used "FBAMembershipProvider" and "FBARoleProvider" (Without the quotation marks).Also, for this example we left "Enable Windows Authentication" checked. This allows us to login either via Windows Authentication or Forms Based Authentication (SharePoint will prompt you when you login for which method you'd like to use).  Click OK.



Now we need to add the user to SharePoint site.

select web application and select UserPolicy.



Click on Add Users and select zone.





Then choose user and give permissions( here am giving full control) and click finish.




VI. Login using membership user

Now we will check FBA, 

Till now FBA configuration is over now i want to check FBA is working for my FBA site or not.
Open FBA site in the browser and select "Forms Authentication".




Enter Aspnet user complete name and password.




if the FBA configuration successfully implemented then u should login to the site otherwise somewhere went wrong in the FBA configuration.




Wednesday, December 11, 2013

where is the Microsoft.SharePoint.IdentityModel location in SharePoint 2013


you can find Microsoft.SharePoint.IdentityModel.dll in the GAC on SharePoint 2013. Note that the GAC location has changed since .net framework 4.0. It's now in c:\windows\microsoft.net\assembly

Here is the location:

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.IdentityModel\v4.0_15.0.0.0__71e9bce111e9429c

Tuesday, September 24, 2013

Error Type: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

I got the following error when i was running my asp.net application.


Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

solution is 

start --> Run -->
c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru


Tuesday, September 10, 2013

Microsoft outlook attachment remainder..

Outlook Attachment Reminder

This Outlook macro will politely remind you to attach a file if it finds the word "attach" in your email and no actual attached file.
Adding a macro to Outlook is easy. Just copy everything below starting with "Private Sub" through "End Sub." In Outlook, select the "Tools | Macro | Visual Basic Editor" menu option. You may need to expand the project by clicking the plus signs under Project1 until you see ThisOutlookSession, and double-click it. Click into the big white empty page and hit Paste.

Click Save and you'll be all set. If you've previously disabled macros you'll need to enable them.
*Note: Outlook Express doesn't support macros.
*Update: Outlook counts files used in Signatures as attachments. If your signature uses one or more files, find the line intStandardAttachCount = 0 and make it equal the number of files in your signature.

Copy and Paste this:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)Dim m As Variant
Dim strBody As String
Dim intIn As Long
Dim intAttachCount As Integer, intStandardAttachCount As Integer
On Error GoTo handleError
'Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature.
intStandardAttachCount = 0
strBody = LCase(Item.Body)
intIn = InStr(1, strBody, "original message")
If intIn = 0 Then intIn = Len(strBody)
intIn = InStr(1, Left(strBody, intIn), "attach")
intAttachCount = Item.Attachments.Count
If intIn > 0 And intAttachCount <= intStandardAttachCount Then
 
    m = MsgBox("It appears that you mean to send an attachment," & vbCrLf & "but there is no attachment to this message." & vbCrLf & vbCrLf & "Do you still want to send?", vbQuestion + vbYesNo + vbMsgBoxSetForeground)
    If m = vbNo Then Cancel = True
 
End If
handleError:
If Err.Number <> 0 Then
    MsgBox "Outlook Attachment Reminder Error: " & Err.Description, vbExclamation, "Outlook Attachment Reminder Error"
End If
End Sub


VBEditor looks like this:


Error Type: system.deployment.application.deploymentdownloadexception unknown subtype in clickonce application.

Recently i have worked with .NET ClickOnce application, in that we published the application and deployed on IIS6.0, every thing working well in IIS6.0. But client changed server and now IIS is 7.5 ,after placing files on IIS7.5 we are unable to download .sdf file from bin folder.

we are getting the following error
ERROR DETAILS
Following errors were detected during this operation.
* [9/10/2013 1:56:27 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
- Downloading http://xxx/Application Files/versionnumber/bin/Debug/yyy_ce.sdf.deploy did not succeed.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Net.WebException
- The remote server returned an error: (404) Not Found.
- Source: System
- Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)


I have tried to solve this problem almost a day but i couldn't.
IIS7.5 is wouldn't allow to view or access file from bin folder.
Hidden Segments used to specifies that certain segments of URLs can be made inaccessible to clients.
So, Finally i just removed bin folder from Hidden Segments in Request Filtering setting from that website on IIS7.5.


After removing that folder from hidden segments, application is able to download .sdf file from server.


and 



Sunday, March 24, 2013

Sign in As different user in SharePoint 2013

In SharePoint 2010 we have "Sign in as different user" option.

But in SharePoint 2013 option removed by MicroSoft.

Now how to get back that option in SharePoint 2013.

Here the steps

1. Go to "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES".

2. Find Welcome.aspx page and open it in notepad++.

Add the following tag after ID_PersonalInformation menu item template

"<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
MenuGroupId="100"
Sequence="100"
UseShortId="true"
/>"


3. Save the file and Now check for "Sign-in as different user" it should be there.


Reasons for Removing "Sign in as different user" are:
  • Documents opened in external applications are saved with an unexpected user account because the external application runs under the windows account logged in to the machine and not the account you have chosen in SharePoint.
  • Page content shows information from the previous user due to cached information.
  • Session variables contain information from previous user as the cookies are not cleared

The Sign in as Different User functionality is not meant to be used as a security feature!
This feature allows users which have more than one AD account to quickly login with a different account to SharePoint - but it does not guarantee that no artifacts from the previous user remain!

We can user the following method for "sing in as different user".

1. Access the SharePoint site by using the following URL:
http://<site url>/_layouts/closeConnection.aspx?loginasanotheruser=true