Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Handling Excel Files...

Handling Excel Files...

Scheduled Pinned Locked Moved ASP.NET
asp-nethelpquestioncsharpsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pavya_Cool
    wrote on last edited by
    #1

    Hi to All, I am trying to handle excel file in my application. Here I am trying to get a cell value in the text box on the event of button click. but whenever i run it shows exception that Access is denied..... my code is as follows.... private Excel.Application oXL=null; private void Button1_Click(object sender, System.EventArgs e) { InitializeComponent(); oXL = new Excel.ApplicationClass(); oXL.Visible = true; Excel.Workbook oWB = oXL.Workbooks.Open("D:\\Pravin\\October-07\\xls\\7starcare-October.xls",0,true,5,"","",true,Excel.XlPlatform.xlWindows,"\t",false, false, 0, true); Excel.Sheets oSheet= oWB.Worksheets; Excel.Worksheet oWS = (Excel.Worksheet)oSheet.get_Item(1); TextBox1.Text= Convert.ToString(oWS.Cells.get_Item(1,1)); } But whenever i run my application it shows exception as follws .... ------------------------------------------------------------------------------------------------ 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.UnauthorizedAccessException: Access 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 , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET write 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. ---------------------------------------------------------------------------------------------------- how can i remove this problem?

    Pravin

    P 1 Reply Last reply
    0
    • P pavya_Cool

      Hi to All, I am trying to handle excel file in my application. Here I am trying to get a cell value in the text box on the event of button click. but whenever i run it shows exception that Access is denied..... my code is as follows.... private Excel.Application oXL=null; private void Button1_Click(object sender, System.EventArgs e) { InitializeComponent(); oXL = new Excel.ApplicationClass(); oXL.Visible = true; Excel.Workbook oWB = oXL.Workbooks.Open("D:\\Pravin\\October-07\\xls\\7starcare-October.xls",0,true,5,"","",true,Excel.XlPlatform.xlWindows,"\t",false, false, 0, true); Excel.Sheets oSheet= oWB.Worksheets; Excel.Worksheet oWS = (Excel.Worksheet)oSheet.get_Item(1); TextBox1.Text= Convert.ToString(oWS.Cells.get_Item(1,1)); } But whenever i run my application it shows exception as follws .... ------------------------------------------------------------------------------------------------ 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.UnauthorizedAccessException: Access 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 , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET write 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. ---------------------------------------------------------------------------------------------------- how can i remove this problem?

      Pravin

      P Offline
      P Offline
      Prateek G
      wrote on last edited by
      #2

      Add another node in ur config file with identity impersonation ="true"

      P 1 Reply Last reply
      0
      • P Prateek G

        Add another node in ur config file with identity impersonation ="true"

        P Offline
        P Offline
        Prateek G
        wrote on last edited by
        #3
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups