Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default impersonate problem

    Win2000, ASP.Net 1.1
    the web application on server (A) read/write to a folder on another server
    (B) on same network .
    I create 2 similar accounts : on web server (A) and server (B)
    with the same username, password ....
    NTFS Permissions is assigned .

    in the web config file :
    impersonation is enabled, and the application accesses the resources using
    the new created account credentials

    when I run the application (even locally) , I get "you are not authorized to
    view this page ...."

    do I need to change machine.config file username and password to match the
    newly created account, and does that affect other web application running on
    the web server (too many) ????

    thanks for help



    zino Guest

  2. Similar Questions and Discussions

    1. OneWay and Impersonate problem
      Working on VS 2005 Beta 2 In my web service I impersonate a specific user with limited rights using the <identity impersonate="true"...
    2. .net Impersonate with integrated authentication client server problem
      Hi, I build a asp.net web application to update user accounts in Active Directory (AD). This application works fine on my test server when I acces...
    3. ASP.NET Webservice Impersonate problem
      ASP.NET webservice application impersonates some user account but connection to ODBC data source sends a default ASPNET (aspnet_wp.exe) user account...
    4. DirectoryEntry Impersonate or WindowsIdentity Impersonate?
      Another security question. Our project interfaces with the Active Directory. To satisfy the security issues, we have a couple options when we talk...
    5. impersonate/delegate problem
      Ok.. so I've read and seen lot of messages and MSDN docs concerning the above issue.. how do I get it to work? I want to impersonate the current...
  3. #2

    Default RE: impersonate problem

    Hi Zino,

    We have reviewed this issue and are currently researching on it. We will
    update you ASAP. Thanks for your patience!

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."

    Kevin Yu [MSFT] Guest

  4. #3

    Default RE: impersonate problem

    Hello,

    How did you access the files on another server? If you remove related code
    temporarily, will the web application work? Can you post your web.config
    for further research?

    BTW, this kind of problem may be related to that the Local Service and
    Network Service accounts do not have Full Control to the "Temporary ASP.NET
    Files" folder or the network shared folder, you may first try to grant such
    permission to see if it will help.

    Luke

    [MSFT] Guest

  5. #4

    Default RE: impersonate problem

    I beleive the problem started when I added a reference to Microsoft.Office to
    the application, and not from impersonation, because the first version I
    published on the web server, didn't have a reference to Office and though we
    didn't have any problem with permissions.
    but but I still don't know how to fix it.
    following is some of what's in the web config file, and the code behind.

    the web config file contains:
    <authentication mode="None" />
    <identity impersonate="true" userName="domainName\NTusername"
    password="NTuserpassword" />

    <authorization>
    <allow users="*" />
    </authorization>


    NTusername is an nt user known on all machine in this domain



    I added the following references:
    - Excel
    - Microsoft.Office.Core
    - .... ... .... ....


    in the code behind, in the imports section:
    - Imports System.IO
    - Imports Microsoft.Office.Interop
    - .... .... ... ..

    the "Not authorized" page appear when I try to call the default page that
    does not contains any code, (just a welcome message), that's why I beleive
    it's a reference problem.


    thanks for your help
    zino Guest

  6. #5

    Default RE: impersonate problem

    Office interop needs more permission than a normal ASP .NET app. Is the
    account "domainName\NTusername" a local administrator? If not, you may try
    to add it and see if this will help.

    Luke

    [MSFT] Guest

  7. #6

    Default RE: impersonate problem

    Any progress on this issue?

    Luke

    [MSFT] Guest

  8. #7

    Default RE: impersonate problem

    I gave the account under which the application is running (impersonating) an
    adminsitrator privilege.
    that's solve part of the problem:
    1- if I request the page as : [url]http://serverName/applicationName[/url]
    I get error: "HTTP Error 403 - Forbidden"

    2- if I request the page as: [url]http://serverName/applicationName/anyPage.aspx[/url]
    it run correctly

    even when I'm logged to the server and I try to browse a page from IIS
    (right click/browse) , the page run correctly , but if I try to browse the
    site (from the left pane) I still getting the error

    I assigned the account all NT permissions on the physical folder.


    thanks for help

    zino Guest

  9. #8

    Default RE: impersonate problem

    How did you set the default page for the site? For example, if you set the
    default page to anyPage.aspx in IIS, and then browse to the site, will it
    be success?

    Luke

    [MSFT] Guest

  10. #9

    Default RE: impersonate problem

    anyPage.aspx is set as default page, and still when I browse to the site
    (either ffrom a remote machine, or from IIS directly(locally) ), if I right
    click the site (left pane in IIS) and browse, the error occured, but if I
    click on the page and browse, it work correctly.

    I don't know if the following, is the reason but :
    Microsof office that is running on the server where the application is, is
    running under different account than the one that the application is
    impersonating.
    What I mean: is it possible that the application, in order to work
    correctly, needs to impersonate the SAME ACCOUNT, that Microsoft Office is
    currently runnning under ????

    thanks





    "[MSFT]" wrote:
    > How did you set the default page for the site? For example, if you set the
    > default page to anyPage.aspx in IIS, and then browse to the site, will it
    > be success?
    >
    > Luke
    >
    >
    zino Guest

  11. #10

    Default RE: impersonate problem

    Hello,

    If the ASP.NET app's account is a local administrator, it is enough to
    invoke the Office component. We don't need impersonate as the one Microsoft
    Office is currently runnning under. To confirm this, you can close all
    Office process on the server and test again.

    Regarding the problem, is there any more information with the error "HTTP
    Error 403 - Forbidden"? For example, "Execute Access Denied"? or "SSL
    require"? Is the virtual folder has been enabled as a IIS app? If you
    create a virtual directory, create a new asp.net application in it, will it
    work?

    Luke

    [MSFT] Guest

  12. #11

    Default RE: impersonate problem

    I uninstall the Office XP PIAs and re-install it back.
    I don't have the denied error anymore, but there is another new error:


    "QueryInterface for interface Microsoft.Office.Interop.Excel._Application
    failed"

    Stack Trace:
    [InvalidCastException: QueryInterface for interface
    Microsoft.Office.Interop.Excel._Application failed.]
    Microsoft.Office.Interop.Excel.ApplicationClass.ge t_Workbooks() +0
    WeekendScript.RefreshDatabase.readButton_Click1(Ob ject sender, EventArgs
    e) +138
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
    System.Web.UI.Page.ProcessRequestMain() +1277



    (RefreshDatabase is the page name, and weekendScript is the app. name)


    and here what inside readButton_click event:
    Protected Sub readButton_Click1(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles readButton.Click

    Dim link As String
    Dim i, max_row, max_col As Int16
    Dim xl As New Excel.Application
    Dim wb As Excel.Workbook = xl.Workbooks.Open("c:\excelFilePath.xls")

    xl.DisplayAlerts = False
    Dim ws As Excel.Worksheet = xl.ActiveSheet

    Dim ds As New DataSet
    Dim dt As New DataTable

    ds = GetTableShema() ' function to get a table shema ..... ... ...

    For Each ws In xl.Worksheets
    max_row = ws.UsedRange.Rows.Count
    max_col = ws.UsedRange.Columns.Count

    For i = 7 To max_row
    link = "F" & i
    If ws.Range(link).Hyperlinks.Count > 0 Then
    Dim dr As DataRow
    dr = ds.Tables(0).NewRow
    dr(0) = ws.Range(link).Hyperlinks(1).Address()
    ds.Tables(0).Rows.Add(dr)
    End If
    Next
    Next

    xl.Quit()
    End Sub

    thanks for help
    zino Guest

  13. #12

    Default RE: impersonate problem

    From the error information, the interface of Excel cannot be found. It
    seems there are some problem in system registry during Office Installation.
    Can you create an Excel object in another application, for example, in a
    VBscript file?

    Luke

    [MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139