grant IIS permission to create excel activex object

Discussion in 'ASP .Net' started by Steve Richter, Apr 14, 2005.

  1. I am getting error in a vbscript:
    ActiveX component cant create object: Excel.Application.

    The vbscript code is:
    Dim objExcel
    Set objExcel = CreateObject("Excel.Application")

    I am pretty sure it is a permission issue because the script works when
    I point the browser directly at the .htm file on the c: drive:
    c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm

    What is the quickest, best way to grant the IIS user ( aspnet? )
    permission to create the activex object in error?

    thanks,
    -Steve
     
    Steve Richter, Apr 14, 2005
    #1
    1. Advertising

  2. Steve Richter

    Elton Wang Guest

    Hi Steve,

    First of all, it's better not to use Office automation on
    server-side. Microsoft does not currently recommend, and
    does not support, Automation of Microsoft Office
    applications on server-side.
    (http://support.microsoft.com/default.aspx?scid=kb;EN-
    US;q257757#kb2)

    Secondly, if you still want to use it, please check out
    following url:
    http://msdn.microsoft.com/library/default.asp?
    url=/library/en-us/dno2k3ta/html/odc_VBNETcallsVBA.asp


    HTH

    Elton Wang





    >-----Original Message-----
    >I am getting error in a vbscript:
    > ActiveX component cant create object: Excel.Application.
    >
    >The vbscript code is:
    > Dim objExcel
    > Set objExcel = CreateObject("Excel.Application")
    >
    >I am pretty sure it is a permission issue because the

    script works when
    >I point the browser directly at the .htm file on the c:

    drive:
    > c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm
    >
    >What is the quickest, best way to grant the IIS user (

    aspnet? )
    >permission to create the activex object in error?
    >
    >thanks,
    >-Steve
    >
    >.
    >
     
    Elton Wang, Apr 14, 2005
    #2
    1. Advertising

  3. Elton Wang wrote:
    > Hi Steve,
    >
    > First of all, it's better not to use Office automation on
    > server-side. Microsoft does not currently recommend, and
    > does not support, Automation of Microsoft Office
    > applications on server-side.
    > (http://support.microsoft.com/default.aspx?scid=kb;EN-
    > US;q257757#kb2)
    >
    > Secondly, if you still want to use it, please check out
    > following url:
    > http://msdn.microsoft.com/library/default.asp?
    > url=/library/en-us/dno2k3ta/html/odc_VBNETcallsVBA.asp
    >
    >
    > HTH
    >
    > Elton Wang
    >


    Hi Elton,

    thanks for the reply. Yes, I have read those articles in the last few
    days. The problem does not appear to be a permission issue because I
    made ASPNET an administrator on my development system and the problem
    remains.

    Thinking about it, there should be no permission issues. I am not
    using Excel on the server side. At least I dont think I am!

    <script language="vbscript">
    Sub exportbutton_onclick
    Dim sHTML, oExcel, oBook
    sHTML = document.all.item("DataGrid1").outerHTML
    Set oExcel = CreateObject("Excel.Application")
    Set oBook = oExcel.Workbooks.Add
    oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
    oBook.HTMLProject.RefreshDocument
    oExcel.Visible = true
    oExcel.UserControl = true
    End Sub
    </script>

    This is all client side scripting, right? So whatever permission is
    required should be a function of the client side IE user.

    My problem remains and I still dont understand. My demo .htm file,
    that runs the above script to copy a rendered <TABLE> to an excel
    spreadsheet, works when I navigate to the .htm file via a c: drive
    physical path:
    c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm

    but it fails with the "ActiveX component cant create object:
    Excel.Application" message when I navigate to it via:
    http://localhost/demosite/VbScript1.htm

    Why cant the ActiveX component create the object?

    thanks,

    -Steve

    >
    >
    >
    >
    > >-----Original Message-----
    > >I am getting error in a vbscript:
    > > ActiveX component cant create object: Excel.Application.
    > >
    > >The vbscript code is:
    > > Dim objExcel
    > > Set objExcel = CreateObject("Excel.Application")
    > >
    > >I am pretty sure it is a permission issue because the

    > script works when
    > >I point the browser directly at the .htm file on the c:

    > drive:
    > > c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm
    > >
    > >What is the quickest, best way to grant the IIS user (

    > aspnet? )
    > >permission to create the activex object in error?
    > >
    > >thanks,
    > >-Steve
    > >
    > >.
    > >
     
    Steve Richter, Apr 14, 2005
    #3
  4. Steve Richter

    Lucas Tam Guest

    "Steve Richter" <> wrote in
    news::

    > thanks for the reply. Yes, I have read those articles in the last few
    > days. The problem does not appear to be a permission issue because I
    > made ASPNET an administrator on my development system and the problem
    > remains.


    Have you tried going through the Office PIA instead?

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Apr 14, 2005
    #4
  5. Lucas Tam wrote:
    > "Steve Richter" <> wrote in
    > news::
    >
    > > thanks for the reply. Yes, I have read those articles in the last

    few
    > > days. The problem does not appear to be a permission issue because

    I
    > > made ASPNET an administrator on my development system and the

    problem
    > > remains.

    >
    > Have you tried going through the Office PIA instead?


    Lucas, just to show who you are dealing with, I had never heard of PIAs
    before reading your post.

    http://msdn.microsoft.com/library/e...icePrimaryInteropAssembliesFAQ.asp?frame=true

    It is fascinating what MS is doing with all its software, but right now
    it is beyond my scope! I would just like this simple process of
    exporting an HTML table to excel to work so I can demostrate it to my
    users.

    thanks,

    -Steve

    > --
    > Lucas Tam ()
    > Please delete "REMOVE" from the e-mail address when replying.
    > http://members.ebay.com/aboutme/coolspot18/
     
    Steve Richter, Apr 14, 2005
    #5
  6. Steve Richter

    Elton Wang Guest

    Hi Steve,

    If you want to run excel automation on client-side via web
    page, it is even worse idea. Internet browser has security
    limit of restricting to access client-side local
    resources. The ASPNET account permission is only on server-
    side. You can't set permission to access client-side
    resources; otherwise it's very easy for someone to make
    harmful code.

    Anyway, it seems you just want to export datagrid to excel
    file. There is a easier way to do it. You can use
    datagrid's RenderControl methos to build a string to
    StringWriter object (via HtmlTextWriter object), set
    Response.ContentType as "application/vnd.ms-excel", and
    use Response.write to output StringWriter's content.
    (I can post the code. Each time I posted code of exporting
    datagrid to excel, it showed very strange signs. It's easy
    for you to search the code.)


    HTH

    Elton Wang


    >-----Original Message-----
    >
    >Elton Wang wrote:
    >> Hi Steve,
    >>
    >> First of all, it's better not to use Office automation

    on
    >> server-side. Microsoft does not currently recommend, and
    >> does not support, Automation of Microsoft Office
    >> applications on server-side.
    >> (http://support.microsoft.com/default.aspx?scid=kb;EN-
    >> US;q257757#kb2)
    >>
    >> Secondly, if you still want to use it, please check out
    >> following url:
    >> http://msdn.microsoft.com/library/default.asp?
    >> url=/library/en-us/dno2k3ta/html/odc_VBNETcallsVBA.asp
    >>
    >>
    >> HTH
    >>
    >> Elton Wang
    >>

    >
    >Hi Elton,
    >
    >thanks for the reply. Yes, I have read those articles in

    the last few
    >days. The problem does not appear to be a permission

    issue because I
    >made ASPNET an administrator on my development system and

    the problem
    >remains.
    >
    >Thinking about it, there should be no permission issues.

    I am not
    >using Excel on the server side. At least I dont think I

    am!
    >
    ><script language="vbscript">
    >Sub exportbutton_onclick
    > Dim sHTML, oExcel, oBook
    > sHTML = document.all.item("DataGrid1").outerHTML
    > Set oExcel = CreateObject("Excel.Application")
    > Set oBook = oExcel.Workbooks.Add
    > oBook.HTMLProject.HTMLProjectItems("Sheet1").Text =

    sHTML
    > oBook.HTMLProject.RefreshDocument
    > oExcel.Visible = true
    > oExcel.UserControl = true
    >End Sub
    ></script>
    >
    >This is all client side scripting, right? So whatever

    permission is
    >required should be a function of the client side IE user.
    >
    >My problem remains and I still dont understand. My

    demo .htm file,
    >that runs the above script to copy a rendered <TABLE> to

    an excel
    >spreadsheet, works when I navigate to the .htm file via a

    c: drive
    >physical path:
    > c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm
    >
    >but it fails with the "ActiveX component cant create

    object:
    >Excel.Application" message when I navigate to it via:
    > http://localhost/demosite/VbScript1.htm
    >
    >Why cant the ActiveX component create the object?
    >
    >thanks,
    >
    >-Steve
    >
    >>
    >>
    >>
    >>
    >> >-----Original Message-----
    >> >I am getting error in a vbscript:
    >> > ActiveX component cant create object:

    Excel.Application.
    >> >
    >> >The vbscript code is:
    >> > Dim objExcel
    >> > Set objExcel = CreateObject("Excel.Application")
    >> >
    >> >I am pretty sure it is a permission issue because the

    >> script works when
    >> >I point the browser directly at the .htm file on the c:

    >> drive:
    >> > c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm
    >> >
    >> >What is the quickest, best way to grant the IIS user (

    >> aspnet? )
    >> >permission to create the activex object in error?
    >> >
    >> >thanks,
    >> >-Steve
    >> >
    >> >.
    >> >

    >
    >.
    >
     
    Elton Wang, Apr 14, 2005
    #6
  7. Elton Wang wrote:
    > Hi Steve,
    >
    > If you want to run excel automation on client-side via web
    > page, it is even worse idea. Internet browser has security
    > limit of restricting to access client-side local
    > resources. The ASPNET account permission is only on server-
    > side. You can't set permission to access client-side
    > resources; otherwise it's very easy for someone to make
    > harmful code.


    makes sense. too bad though, it is very functional. And I would still
    like to know why it does not work!

    >
    > Anyway, it seems you just want to export datagrid to excel
    > file. There is a easier way to do it. You can use
    > datagrid's RenderControl methos to build a string to
    > StringWriter object (via HtmlTextWriter object), set
    > Response.ContentType as "application/vnd.ms-excel", and
    > use Response.write to output StringWriter's content.
    > (I can post the code. Each time I posted code of exporting
    > datagrid to excel, it showed very strange signs. It's easy
    > for you to search the code.)


    I have tested that method and it looks like great functionality. Would
    prefer that the excel application start in its own familiar window, but
    that is ok.

    I guess this method is the prefered, secure way of exporting web page
    contents to a client side application. Curious how I can write my own
    client side application that functions like excel does in this context.

    thanks,

    -Steve
     
    Steve Richter, Apr 14, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Takita
    Replies:
    0
    Views:
    2,155
    Brian Takita
    Apr 19, 2005
  2. =?Utf-8?B?a2FhcmtleQ==?=

    grant folder write permission

    =?Utf-8?B?a2FhcmtleQ==?=, Oct 10, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,924
    =?Utf-8?B?a2FhcmtleQ==?=
    Oct 11, 2005
  3. Hank Barta
    Replies:
    1
    Views:
    3,517
    Hank Barta
    Jan 25, 2004
  4. Rach
    Replies:
    0
    Views:
    460
  5. Steve Kershaw
    Replies:
    4
    Views:
    6,925
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 17, 2007
Loading...

Share This Page