Results 1 to 14 of 14

Thread: [RESOLVED] Using shared folder name as path

  1. #1
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    Resolved [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.

  2. #2
    Fanatic Member
    Join Date
    Jun 04
    Location
    All useless places
    Posts
    916

    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.

  3. #3
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    Smile Re: Using shared folder name as path

    Great, that will help. Thank you.

  4. #4
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,838

    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

  5. #5
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    Question 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.

  6. #6
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,838

    Re: Using shared folder name as path

    What permissions does this user have on that machine?

    Gary

  7. #7
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    Question 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.

  8. #8
    Fanatic Member
    Join Date
    Jun 04
    Location
    All useless places
    Posts
    916

    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.

  9. #9
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    Question 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.

  10. #10
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,838

    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

  11. #11
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    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.

  12. #12
    Fanatic Member
    Join Date
    Jun 04
    Location
    All useless places
    Posts
    916

    Re: Using shared folder name as path

    Quote Originally Posted by snufse View Post
    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?

  13. #13
    Fanatic Member snufse's Avatar
    Join Date
    Jul 04
    Location
    Jupiter, FL
    Posts
    873

    Smile 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.

  14. #14
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,838

    Re: Using shared folder name as path

    Quote Originally Posted by rjv_rnjn View Post
    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.

    Quote Originally Posted by rjv_rnjn View Post
    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
  •