|
-
Jul 20th, 2012, 01:15 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Using shared folder name as path
I have an application where I export some crystal reports to a shared folder like:
Code:
Dim ReportFilePath As String = "\\XXXXX\AutoLoad Reports\Reports"
DiskOpts.DiskFileName = ReportFilePath & "\" & ReportName
myCrystalReport1.ExportOptions.DestinationOptions = DiskOpts
myCrystalReport1.Export()
My question is: I looks it uses the machine account to access this folder like:
domain\vgiwpw03-xxx$ (name of the server is vgiwpw03-xxx2). Is there a way to programaticall speciy which account to use accessing the shared folder? We do not like to use machine accounts as this may change if we switch servers etc. Thank you.
Last edited by snufse; Jul 23rd, 2012 at 07:46 AM.
-
Jul 20th, 2012, 02:53 PM
#2
Fanatic Member
Re: Using shared folder name as path
That is when you would use ASP.Net impersonation.
Read this http://msdn.microsoft.com/en-us/library/xh507fc5.aspx
followed by http://support.microsoft.com/kb/306158 to get a good understanding.
-
Jul 20th, 2012, 03:58 PM
#3
Thread Starter
Fanatic Member
Re: Using shared folder name as path
Great, that will help. Thank you.
-
Jul 23rd, 2012, 01:10 AM
#4
Re: [RESOLVED] Using shared folder name as path
Hello,
Did you end up using impersonation?
Just to point out, did you try configuring the identity of the user that is running the application pool that you application is running in? Rather than using the identity of the logged in user?
Gary
-
Jul 23rd, 2012, 07:46 AM
#5
Thread Starter
Fanatic Member
Re: [RESOLVED] Using shared folder name as path
Tried using this and it works:
Code:
<identity impersonate="true" userName="domain\appnet" password="xyz4" />
We would like to force a specific user.
Getting error:
Error 2 Failed to start monitoring changes to 'C:\Documents and Settings\vgwprja\My Documents\Visual Studio 2008\WebSites\WRQ_AutoLoad_Reports\global.asax' because access is denied.
The user is a valid user. Any ideas? Thank you.
-
Jul 23rd, 2012, 07:55 AM
#6
Re: Using shared folder name as path
What permissions does this user have on that machine?
Gary
-
Jul 23rd, 2012, 08:15 AM
#7
Thread Starter
Fanatic Member
Re: Using shared folder name as path
I gave AppNet access to myDocuments folder where the application is located (my local desktop). No when I run the app I get:
Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access 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.IO.FileLoadException: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.
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 'AjaxControlToolkit' could not be loaded.
=== Pre-bind state information ===
LOG: User = Unknown
LOG: DisplayName = AjaxControlToolkit
(Partial)
LOG: Appbase = file:///C:/Documents and Settings/vgwprja/My Documents/Visual Studio 2008/WebSites/WRQ_AutoLoad_Reports/
LOG: Initial PrivatePath = C:\Documents and Settings\vgwprja\My Documents\Visual Studio 2008\WebSites\WRQ_AutoLoad_Reports\bin
Calling assembly : (Unknown).
[FileLoadException: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.]
I have given the user AppNet full control to the AjaxControlToolkit.dll
Last edited by snufse; Jul 23rd, 2012 at 08:18 AM.
-
Jul 23rd, 2012, 09:47 AM
#8
Fanatic Member
Re: Using shared folder name as path
Try putting your credentials and see if the app works. If so, then revert to the AppNet user and add this user to IIS_IUSRS group (in the Local users & Groups window -- you can get there from Control Panel -> User adminstration).
I am suggesting on the pretext that the AppNet user does not have access to temporary ASP.Net folder.
-
Jul 23rd, 2012, 11:59 AM
#9
Thread Starter
Fanatic Member
Re: Using shared folder name as path
It works fine executing from my local desktop either as AppNet or myself, it connects to a server and writes text files. Now, if I publish the app to the internal web server and run it, it connects as myself even if I have impersonated with AppNet, nothing is being write to the server.
Till I have this figured out I will continue using the machine account which works.
-
Jul 24th, 2012, 12:47 AM
#10
Re: Using shared folder name as path
Again...
Why are you forcing the impersonation of a single user?
Why not simply change the identity of the user that is running the application pool within IIS?
Gary
-
Jul 24th, 2012, 07:07 AM
#11
Thread Starter
Fanatic Member
Re: Using shared folder name as path
The reason I am using a single user is because the app calls another server where it writes text files to folders and they would like to control the rights to do so by a single user, makes sense?
How would I change to a single user within IIS? Thank you.
-
Jul 24th, 2012, 09:01 AM
#12
Fanatic Member
Re: Using shared folder name as path
 Originally Posted by snufse
How would I change to a single user within IIS?
You can create a new app pool. Then go to Advanced Settings. For Identity the default value is "ApplicationPoolIdentity", click on "..." and then add a custom account. However, in my opinion, if you need the user only for a specific task then impersonation for that task is preferable over using that identity for the entire application. But this could be argued both ways, and hence you've to take your pick.
What IIS version are you using? Would this(http://technet.microsoft.com/en-us/l...(v=WS.10).aspx) be any help?
-
Jul 24th, 2012, 12:09 PM
#13
Thread Starter
Fanatic Member
Re: Using shared folder name as path
I think I now have some ideas on how to move ahead. Thank you guys for all your input.
-
Jul 24th, 2012, 03:20 PM
#14
Re: Using shared folder name as path
 Originally Posted by rjv_rnjn
You can create a new app pool. Then go to Advanced Settings. For Identity the default value is "ApplicationPoolIdentity", click on "..." and then add a custom account.
Yes, this is what I was referring to.
 Originally Posted by rjv_rnjn
However, in my opinion, if you need the user only for a specific task then impersonation for that task is preferable over using that identity for the entire application. But this could be argued both ways, and hence you've to take your pick.
Agreed. Everyone has there own personal preference. Personally, I would create a domain service account, with highly restricted persons, only having access to what is required, and use this to run the entire site.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|