A A A Font Size

helloitsliam

SharePoint 2007 - Multiple Login Prompts

UPDATE: There is one side affect of using code like this. If you add this to a site you will not be able to use SharePoint Designer on that site. If you have the code running on the FBA site and then not on the AD side you will be fine. If you run it on both then you will need to remove the code if editing with SharePoint Designer is required on that specific site.

So you work with SharePoint and you have an Internal Active Directory site as well as Forms Based Site and for some reason whenever you try to access documents you end up with more login prompts that you expected. Well there is a test / fix that you could use, it requires adding some code to the "Global.asax" file that exists within the directory that Internet Information Server (IIS) uses for your site. An example would be:

C:\inetpub\wwwroot\wss\VirtualDirectories\intranet

You simply open the file and replace the default code:

<%@ Assembly Name="Microsoft.SharePoint"%>
<%@ Application Language="C#" Inherits="Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication" %>

with this code:

<%@ Assembly Name="Microsoft.SharePoint"%>
<%@ Application Language="C#" Inherits="Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication" %>

<SCRIPT language="C#" runat="server">
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
{
 HttpApplication app=sender as HttpApplication;

 if (app.User.Identity.IsAuthenticated)
 return;

 HttpRequest request = app.Request;

 if (request.UserAgent != "Microsoft Office Protocol Discovery"
  && request.UserAgent != "Microsoft Data Access Internet Publishing Provider Protocol Discovery"
  && request.UserAgent != "MSFrontPage/12.0")
 return;


 HttpResponse response = app.Response;

 response.StatusCode = 404;

 response.End();
}
</SCRIPT>

This code suppresses the extra code by checking the request useragent string for specific protocols. Ultimately you would create this code as an HttpModule instead of using the "Global.asax". However testing this is fine. I have this working on a few installs at the moment and it works well. Hope this helps.

You must sign in to rate content.
(Unrated)

Comments

There are no comments yet for this post.

Leave a Comment

You must be logged in to post a comment.
Superstar
Liam Cleary
Senior Solution Architect | SharePoint MVP
SUSQTECH
Sheffield, UK
Liam is working as usual, SharePoint, SharePoint and then some more SharePoint!!

Search This Blog

 

© 2010 SusQtech. All rights reserved.
Powered by SharePoint Server 2007 and using the MemberToMember SharePoint Add-On for social media capabilities.