Thursday, 10 July 2014

this configuration section cannot be used at this path

Hi folks, today i configured IIS in my windows 8.1 system.
I created Application and hosted in IIS 8.5 and accessed then faced this error.

Config Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

i know that there is no application level Error, then i realized this is because of IIS settings then i
did the following settings.

1. Go to Control panel
2. go to Programs and features
3. then select the Turn windows features on or Off.
4. select the Internet information services. on world wide web services.
6. click on Application developement features.

7. Check all features except CGI

Wednesday, 9 July 2014

How to enable Windows Authentication for a WebSite in IIS

Today am going to Explain about the Basic of Authentication.

We need to know about how to Enable the Windows authentication for a Web Site, Web Application, Windows Service in IIS(7.5/8.0/8.5).

 Open Internet Information Service Manager (IIS) .

1.     If you are using Window 8 or 8.1:
a.       Click on  Control Panel (Press the Windows key and Press the Letter X)
b.      Click on Administrative tools and then click on Internet information Services (IIS)
2.     If you are Using Window 7
a.       Click on start button and then go to control Panel.
b.      Double – click on Administrative Tools, and the double click on Internet Information Service (IIS).

      3.     In the Connection Pane, expand the Server Name and expand the site, then select Web site or    Web  Application OR Windows Service for which you want to enable the Authentication.

4.     Scroll the IIS in the Center Panel select the Authentication

    5 .        By default windows authentication is disable mode. 


    6. we need to enable by selecting of enable from Actions Pane (right side in the IIS).


Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Workbook'

I just created an Application and I Hosted in IIS 7.5. 

I am instantiated the excel object then am getting Error Like this

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Workbook'. This operation failed
because the QueryInterface call on the COM component for the interface with IID '{000208DA-0000-0000-C000-000000000046}' failed due to the
following error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

//Create instance to Excel workbook to work with chart data
Microsoft.Office.Interop.Excel.Workbook dataWorkbook = (Microsoft.Office.Interop.Excel.Workbook)chartData.Workbook;

To Resolve this Issue you have to Office run-time Installed on the Server.
and  Com+ Configuration settings and Permissions i Explained in the My previous Post
for  Microsoft Excel Application.


Monday, 7 July 2014

Create a PowerPoint Presentation Using C# and Embed a Picture

Create a PowerPoint Presentation Using C# and  Embedding the  Images

Today I will show how to Create PowerPoint Presentation Using C# (Interop).

Creating PowerPoint Presentations Using Office Automation, this will be very useful for IT departments and Organizations for their Employees.

We need to add following references
Embedding the  Images in Microsoft PowerPoint Presentations.

using Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Interop.Graph;
using Microsoft.Office.Core;

Microsoft.Office.Interop.PowerPoint.Application pptApplication = new Microsoft.Office.Interop.PowerPoint.Application();
Microsoft.Office.Interop.PowerPoint.Slides slides;
Microsoft.Office.Interop.PowerPoint._Slide slide;
Microsoft.Office.Interop.PowerPoint.TextRange objText;
Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);
Microsoft.Office.Interop.PowerPoint.CustomLayout customLayout = pptPresentation.SlideMaster.CustomLayouts[Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutText];

// Create new Slide
slides = pptPresentation.Slides;
slide = slides.AddSlide(1, customLayout);

// Add title
objText = slide.Shapes[1].TextFrame.TextRange;
objText.Text = "journey to dotnet authority";
objText.Font.Name = "Trebuchet MS";
objText.Font.Size = 32;
string innerChartFilePath = "D:\Images\Profile.png";
slide.Shapes.AddPicture(innerChartFilePath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, 10, shape.Top, width,height);
pptPresentation.SaveAs(@"D:\Image"+DateTime.Now.Ticks.ToString()+".pptx", Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue);