Error while using Keyword Query object in asp.net application for search in sharepoint - keyword

I am trying to use Keyword Query object in asp.net application.
I wrote this code :
Namespace : using System.Data.SqlClient;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Search;
using Microsoft.SharePoint.Search.Query;
Page load event:
GridView grd = new GridView();
DataTable dt = new DataTable();
KeywordQuery qRequest = new KeywordQuery("http://server/ril");
qRequest.QueryText = "RILLIB";
ResultTableCollection resTableCollect = qRequest.Execute();
ResultTable resTable = resTableCollect[ResultType.RelevantResults];
DataTable dtTable = new DataTable();
dtTable.Load(resTable, LoadOption.OverwriteChanges);
grd.DataSource = dtTable;
grd.DataBind();
Page.Controls.Add(grd);
Ok? Whe i run it gives me error : Exception from HRESULT: 0xC0041228
When i saw Logs i found these lines. What the error exactly ? how can i remove that?
Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6481
Date: 05/11/2009
Time: 6:12:25 PM
User: N/A
Computer: SERVER
Description:
Application Server job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (41fdea47-166f-4d9f-9cd0-4f3dd0f5cd5b).
Reason: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied.
Techinal Support Details:
System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.FileInfo.CreateText()
at Microsoft.Search.Administration.Security.HOSTSFile.CleanupDedicatedGathering(Hashtable HOSTSFileMappings, StringBuilder HOSTSComments, IEnumerable obsoleteHosts, String dedicatedName, Boolean isDirty)
at Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(SearchServiceInstance searchServiceInstance, SPServer dedicatedWebFrontEndServer, IList`1 previousWebApplicationHostNames)
at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource(IDictionary applications)
at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize()
at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Related

Docker install fail with error This access control list is not well-formed and cannot be modified

I got this error:
\Windows>System.InvalidOperationException: This access control list is not well-formed and cannot be modified
System.Security.AccessControl.CommonAcl.ThrowIfNotCanonical()
System.Security.AccessControl.CommonAcl.AddQualifiedAce(SecurityIdentifier sid, AceQualifier qualifier, Int32 accessMask, AceFlags flags, ObjectAceFlags objectFlags, Guid objectType, Guid inheritedObjectType)
System.Security.AccessControl.DiscretionaryAcl.AddAccess(AccessControlType accessType, SecurityIdentifier sid, Int32 accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags)
System.Security.AccessControl.CommonObjectSecurity.ModifyAccess(AccessControlModification modification, AccessRule rule, Boolean& modified)
System.Security.AccessControl.CommonObjectSecurity.AddAccessRule(AccessRule rule)
Docker.Core.PermissionUtils.RemoveGlobalWrite(ILogger logger, String path) C:\workspaces\4.12.x\src\github.com\docker\pinata\win\src\Docker.Core\PermissionUtils.cs:line 30
CommunityInstaller.Program.Main(String[] args)strong text

"System.ComponentModel.Win32Exception: Access is denied" error in Release Management client

I have been working on Release Management client for last few months. I tried to configure "agentless" deployment using chef.
I configured all the attributes that were mentioned in the below documentation.
Reference can be found here and here.
After creating the release template, I tried to deploy it on the chef host, but it throws an exception as
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: Access is denied
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Microsoft.TeamFoundation.Release.CommonConfiguration.Helpers.ProcessHelper.ExecuteProcess(ProcessStartInfo startInfo, String argumentsWithStarsForPassword, Int32 timeoutInMilliseconds, Boolean waitForExit)
at Microsoft.TeamFoundation.Release.CommonConfiguration.Helpers.ProcessHelper.RunProcess(String fileName, String arguments, String workingDirectory, Boolean waitForExit)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.KnifeInvoker.Invoke(String arguments, String existingLogs)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.ChefCommands.SetAttribute(ChefDeploymentInfo deploymentInfo)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.ChefOnPremDeploymentActions.InvokePipeline(ChefDeploymentInfo deploymentInfo)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.ChefOnPremDeploymentActions.TriggerDeployment(DscComponent dscComponentParameters, String nodeName, String isUnixNode, String userName, String password, String componentName, String attributeName, String knifeInstallationPath, String chefRepoPath)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.Dsc.DscComponentInstaller.InvokeMethodByReflection(String methodArguments)
Can anyone please help me to find out what I missed and what needs to be configured?
I used Unix based credentials, I checked one step forward under Server Manager -> All Servers -> Events page. The error is mentioned below
Timestamp: 8/5/2016 1:36:46 PM
Message: Access is denied: \r\n\r\n at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Microsoft.TeamFoundation.Release.CommonConfiguration.Helpers.ProcessHelper.ExecuteProcess(ProcessStartInfo startInfo, String argumentsWithStarsForPassword, Int32 timeoutInMilliseconds, Boolean waitForExit)
at Microsoft.TeamFoundation.Release.CommonConfiguration.Helpers.ProcessHelper.RunProcess(String fileName, String arguments, String workingDirectory, Boolean waitForExit)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.KnifeInvoker.Invoke(String arguments, String existingLogs)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.ChefCommands.SetAttribute(ChefDeploymentInfo deploymentInfo)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.ChefOnPremDeploymentActions.InvokePipeline(ChefDeploymentInfo deploymentInfo)
at Microsoft.TeamFoundation.Release.MonitorServices.Chef.OnPrem.ChefOnPremDeploymentActions.TriggerDeployment(DscComponent dscComponentParameters, String nodeName, String isUnixNode, String userName, String password, String componentName, String attributeName, String knifeInstallationPath, String chefRepoPath)
Category: General
Priority: -1
EventId: 0
Severity: Error
Title:
Machine: AMAZONA-U157LUU
Application Domain: ReleaseManagementMonitor.exe
Process Id: 1516
Process Name: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Release Management\bin\ReleaseManagementMonitor.exe
Win32 Thread Id: 4956
Thread Name:
Extended Properties:
The error message indicates a "Access is denied" issue. You need to check whether you have filled the correct Configuration variables especially Username/Password in the action “Deploy Using Chef”.
Username/Password: Credentials to connect to the node. This should be
a user (sudo privileges) with ssh permission for UNIX based systems
and an user with winrm permission(or local admin) for WINDOWS based
systems
NodeName: Name of the Chef Node where you want to deploy the application. The parameter passed should match the name of the Server linked in RM Standard environment.
Note : Make sure your node name match with the same in node input field.
IsUnixNode: Specify type of the machine. In case of UNIX based machines this parameter is set to true.
Username/Password: Credentials to connect to the node. This should be a user (sudo privileges) with ssh permission for UNIX based systems and an user with winrm permission(or local admin) for WINDOWS based systems
Component Name: Name of the component to be deployed.
Note: Select your appropriate component in your project.
Attribute Name: Name of the Chef node attribute which is used by cookbook(s) to get application package as explained earlier. Nested attributes are supported. The format of this name is: [‘AttributeLevel1’][‘AttributeLevel2’]…
Note: Verify you chef attribute name and attribute input field name. ex: ['test']
KnifeInstallationPath: Absolute path to knife.bat file on Release Management Server
Note:upto your knife.rb file location. ex:C:\opscode\chefdk\bin\knife.bat
ChefRepoPath: Chef repo directory path on RM server.
Note: upto knife.rb located folder. Ex :C:\Users\Administrator.TFS\.chef

Could not load file or assembly 'Glimpse.AspNet' or one of its dependencies

I have just tried to install Glimpse.MVC5 via Nuget.
After doing that I cannot run my application.
The error says that the assembly Glimpse.AspNet cannot be loaded, but I found that the dll at C:\Users\xxx\Documents\Visual Studio 2013\Projects\yyy\zzz\packages\Glimpse.AspNet.1.8.0\lib\net45\Glimpse.AspNet.dll does exist.
The error in full is;
Server Error in '/' Application.
Could not load file or assembly 'Glimpse.AspNet' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Glimpse.AspNet' or one of its dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Glimpse.AspNet' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Glimpse.AspNet
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Glimpse.AspNet | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/xxx/Documents/Visual Studio 2013/Projects/yyy/zzz/zzz.yzyzyz/
LOG: Initial PrivatePath = C:\Users\xxx\Documents\Visual Studio 2013\Projects\yyy\zzz\zzz.yzyzyz\bin
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\xxx\Documents\Visual Studio 2013\Projects\yyy\zzz\zzz.yzyzyz\web.config
LOG: Using host configuration file: C:\Users\xxx\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/fec53fa6/71c52709/Glimpse.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/fec53fa6/71c52709/Glimpse.AspNet/Glimpse.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Users/xxx/Documents/Visual Studio 2013/Projects/yyy/zzz/zzz.yzyzyz/bin/Glimpse.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Users/xxx/Documents/Visual Studio 2013/Projects/yyy/zzz/zzz.yzyzyz/bin/Glimpse.AspNet/Glimpse.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/fec53fa6/71c52709/Glimpse.AspNet.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/fec53fa6/71c52709/Glimpse.AspNet/Glimpse.AspNet.EXE.
LOG: Attempting download of new URL file:///C:/Users/xxx/Documents/Visual Studio 2013/Projects/yyy/zzz/zzz.yzyzyz/bin/Glimpse.AspNet.EXE.
LOG: Attempting download of new URL file:///C:/Users/xxx/Documents/Visual Studio 2013/Projects/yyy/zzz/zzz.yzyzyz/bin/Glimpse.AspNet/Glimpse.AspNet.EXE.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'Glimpse.AspNet' or one of its dependencies. The system cannot find the file specified.]
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +39
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +37
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +38
[ConfigurationErrorsException: Could not load file or assembly 'Glimpse.AspNet' or one of its dependencies. The system cannot find the file specified.]
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +348
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +19
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +39
System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +42
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +158
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +950
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +82
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not load file or assembly 'Glimpse.AspNet' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9931916
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248
I found what the problem was.
After I created a new project to my application, the project I loaded Glimpse into was not building, and that is why there was a problem. When I build the project individually it works. I need to sort out my builds

How can I propagate an identity from an asp.net mvc application in order to access a tfs server?

I am developing an asp.net mvc application to extract some data from a TFS server.
Right now I am having problems with authentication on the TFS server. When I run the app from my local machine everything works fine, since it propagates my windows identity to the server, but when I deploy the app to my IIS8 server, since there's no user logged on, it won't work.
I would like to avoid using windows authentication on the IIS8 server, since I do not want to maintain the user control with windows groups. Instead I would like only to authenticate the user on my AD, store the identity info and propagate it to the TFS server, but I am clueless on how to do that.
Can you guys help me out? Right now my asp.net mvc app has no authentication and I get the following message:
[UnauthorizedAccessException: Access to the registry key 'HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage\VisualStudio' is denied.]
Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +4325774
Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions) +10872754
Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options) +14
Microsoft.VisualStudio.Services.Common.TokenStorage.RegistryTokenStorageHelper.GetRootKey(String subkeyName) +50
Microsoft.VisualStudio.Services.Common.TokenStorage.RegistryTokenStorage.RetrieveToken(VssTokenKey tokenKey) +57
Microsoft.VisualStudio.Services.Common.TokenStorage.VssTokenStorage.Retrieve(VssTokenKey tokenKey) +15
Microsoft.TeamFoundation.Client.TfsClientCredentialStorage.RetrieveToken(Uri serverUrl, VssCredentialsType credentialType) +58
Microsoft.TeamFoundation.Client.CookieCredential.OnCreateTokenProvider(Uri serverUrl, HttpWebResponse response) +127
Microsoft.TeamFoundation.Client.IssuedTokenCredential.CreateTokenProvider(Uri serverUrl, HttpWebResponse response, IssuedToken failedToken) +45
Microsoft.TeamFoundation.Client.TfsClientCredentials.TryGetTokenProvider(Uri serverUrl, IssuedTokenProvider& provider) +95
Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestHelpers.PrepareWebRequest(HttpWebRequest webRequest, Guid sessionId, String operationName, CultureInfo cultureInfo, TfsRequestSettings settings, TfsClientCredentials credentials, IdentityDescriptor impersonate, IssuedToken& currentToken, IssuedTokenProvider& tokenProvider) +136
Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestHelpers.CreateSoapRequest(Uri requestUri, Guid sessionId, String soapAction, String operationName, CultureInfo cultureInfo, TfsRequestSettings settings, TfsClientCredentials credentials, IdentityDescriptor impersonate, IssuedToken& currentToken, IssuedTokenProvider& tokenProvider) +106
Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.CreateWebRequest() +154
Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest() +599
Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout) +243
Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs) +91
Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, Int32 lastChangeId, Int32 features) +175
Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions) +92
Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected() +723
Microsoft.TeamFoundation.Client.TfsConnection.EnsureAuthenticated() +25
Your first issue is that your need to make the account that the website is running under an administrator on your web server. Current permissions are not going to cut the mustered.
Additionally you are going to hit a double hop authentication issue with Kerberos ( security is a pain) and you need to configure an SPN for the account to show it to proxy Kerberos authentication tokens to the TFS server. User SetSPN to configure it, and you will likely need the help of a domain admin.

error in reading a file

I'm not able to open the file when I click on the link on page in MVC. I get the following message. I've added the impersonation in the code. I'm able to delete and save the file.
Access to the path '\servername\folder1\folder2\folder3\foder4\filename.pdf' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path '......same as above....' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 35: ' This gets executed for every action on this controller
Line 36: ViewData("READONLY") = IIf(SessionData.IsReadOnly, "Y", "N")
Line 37: MyBase.Execute(requestContext)
Line 38: End Sub
Line 39:
Source File: C:\Posfx\trunk\posfx\camonline\Controllers\ApplicationController.vb Line: 37
Stack Trace:
[UnauthorizedAccessException: Access to the path '\\cambridge-uat-d\NetworkShare\DealDocumentShare\201102\online\136-test file 2.pdf' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7716623
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +66
System.Web.HttpResponse.TransmitFile(String filename, Int64 offset, Int64 length) +134
System.Web.HttpResponse.TransmitFile(String filename) +12
System.Web.HttpResponseWrapper.TransmitFile(String filename) +11
System.Web.Mvc.FilePathResult.WriteFile(HttpResponseBase response) +37
System.Web.Mvc.FileResult.ExecuteResult(ControllerContext context) +268
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +10
System.Web.Mvc.<>c__DisplayClass11.<InvokeActionResultWithFilters>b__e() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251
System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251
System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251
System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +178
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
Cambridge.Online.ApplicationController.Execute(RequestContext requestContext) in C:\Posfx\trunk\posfx\camonline\Controllers\ApplicationController.vb:37
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
I think the error message is more than clear, it even tells you what to do which is rare. Your web site runs under a special account with limited privileges. Depending on the version of IIS you are using this account could vary. So you should consider granting read access to this account to the remote folder you are trying to access, which according to the exception you are getting is \servername\folder1\folder2\folder3\foder4.
You are saying that you've added impersonation, but impersonation works only for local resources. In your case it seems that you are trying to access a remote server (a remote share). In this case you need delegation and not impersonation. So you could configure your site to run under a domain account which has read access to this remote share.

Resources