Images and CSS not shown in website hosted in IIS Server 7.5

December 28, 2016

Recently I came across a unseen problem.

A website working perfectly While debugging using Visual studio 2010 . All the Images and CSS are loaded perfectly as expected.

However when I hosted the web site in IIS Server version 7.5 , CSS and Image files are not shown in the website.

After a long research , Finally found that the Static Content handler is not enabled in the IIS Server.

After Enabling Static content , issue got fixed. Now the Images and CSS are shown in the Website as expected.

To Enable Static content Handler :

1. Open Turn Windows Features On or Off

2. Select Internet Information Services

3. Then World Wide Web Services

4. Under Common HTTP Features Check the Static Content,

5. Click Ok.

iis

 

Thanks for reading this article!! please leave your comments and suggestion about this article.

Advertisements

Export gridview data to Excel document in asp.net C#

December 28, 2016

Follow the  steps involved :

Step 1:

Create a aspx page with a grid view control.

ViewExcelReport.aspx

aspx code

 Step 2:
Add the code for the button click in ViewExcelReport.aspx.cs

code

Now you are done, you can export the grid view in to Excel format.

if you’re getting any error message like

RegisterForEventValidation can only be called during Render();

To solve, add the overriding function VerifyRenderingInServerForm event in code. 

Thanks for reading this article!! please leave your comments and suggestion about this article.

 


How to Show information / warnings in SharePoint

March 2, 2016

In SharePoint , Status bar is used to display information / warnings  using Javascript.This script is added at the client side.

The status script functions are listed out in the SP.UI.Status class. in SP.js which is added in master page by default.

The SP.UI.Status class has 6 functions.
           1. addStatus   – used to add the status bar information
           2. appendStatus  – used to append the information
           3. removeAllStatus – remove all  status
           4. removeStatus – remove status
           5. setStatusPriColor – used to set color for the status bar information
           6. updateStatus – update  / replage the status information

    So simply follow the steps the to add the information / warning in SharePoint  site.

     1. Add a Script Editor / Content editor web part in the page



    2. Edit snippet and add the below code to show the information.


    window.onload = function(){
    var Status;
    Status = SP.UI.Status.addStatus(“Information : “, “ We sincerely apologize for the inconvenience.Our site is currently undergoing maintenance and upgrades and will return return shortly.“, true);
      SP.UI.Status.setStatusPriColor(Status, “yellow”);

      }



    3. Save the page and refresh.

    Now the page looks as below












    Woo hoo , Now its very simple to show the notification for alerts/ warnings in SharePoint site.

    For more info , refer https://goo.gl/45xmbX


    http error 503. the service is unavailable in IIS after enabling 32 bit application

    October 7, 2015

    By default, IIS running on a 64 bit computer does not support running a 32 bit application. However, you can change the setting in an Application Pool under which the application is running by setting the ‘Enable 32-bit Applications‘ to true


    In IIS, I created a new web-site and change the application pool to enable 32-bit application to support my 32 bit application.

    While accessing the apppplication i got the  “HTTP Error 503. The service is unavailable” error.
    Also Identified that the application pool was stopped repeatedly when i tried to access the  application. Finally got the below error from event viewer.

    The Module DLL ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\isapi\spnativerequestmodule.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.

    Solution:
    Run the following command in Windows Command Prompt. 


    "%systemroot%\system32\inetsrv\AppCmd.exe" set config -section:system.webServer/globalModules
    /[name='SPNativeRequestModule'].preCondition:integratedMode,bitness64

    This  will solve the problem to load SPNativeRequestModule when the application pool is running in Integrated Mode and 64-bit application mode.
    Hope the issue solved !!

    retrieving the com class factory for component with clsid 80040154 Retrieving the COM class factory for component with CLSID {…} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)

    October 5, 2015

    PROBLEM:
    When you run the .net Code in X64 Environment you will get the following error message.
    ” Failed –Retrieving the COM class factory for component with CLSID ….”
    E.g. in Retrieving the COM class factory for component with CLSID {94773112-72E8-11D0-A42E-00A024DED613} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)
    WORKAROUND:
    The possible workaround is modify your project’s platform from ‘Any CPU’ to ‘X86’ (in Project’s Properties, Build/Platform’s Target)
    ROOTCAUSE
    The VSS Interop is a managed assembly using 32-bit Framework and the dll contains a 32-bit COM object. If you run this COM dll in 64 bit environment, you will get the error message.
    SOLUTION
    1. Open IIS
    2. Select  the application pool used by your website
    3. Click Advanced setting
    4. enable 32-bit Application to TRUE which was set to False by default.
    5. Restart IIS 
    6. Now its resolved. 🙂 



    Bootstrap – A Perfect framework for web Development

    December 1, 2014

    In the my Recent projects , i am came across various framework for .Net based web Application. But quite interested and flexible framework is Bootstrap

    Bootstrap – a new start-up for more creativity in web developments.

    Bootstrap is a powerful front-end framework for faster and easier web development. It includes HTML and CSS based design templates for common user interface components.
    Also gives more ability  to create responsive layout.
    why we have to opt  Bootstrap:
    • Responsive layout
    • easy to use
    • Compatible with most of the browsers.
    • Open Source –  completely free to download and use
    To Download GetBootstrap here

    Bootstrap comes with CSS , javascript in the  form of jquery 

    Structure:
    bootstrap/
    ├── css/
    ├── bootstrap.css
    ├── bootstrap.min.css
    ├── js/
    ├── bootstrap.js
    ├── bootstrap.min.js
    └── img/
    ├── glyphicons-halflings.png
    └── glyphicons-halflings-white.png

    http://getbootstrap.com/javascript/


    My  first Example,  i always used to copy the code from the examples given and give a try.

    <div class="modal fade">
    <div class="modal-dialog">
    <div class="modal-content">
    <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×<span class="sr-only">Close
    <h4 class="modal-title">Modal title

    <div class="modal-body">

    One fine body



    <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close
    <button type="button" class="btn btn-primary">Save changes




    This is just a note to convey that Bootstrap is a Perfect framework for web Development projects.



    Images and CSS not shown in website hosted in IIS Server 7.5

    June 18, 2014

     Recently I came across a unseen problem.

    A website working perfectly While debugging using Visual studio 2010 . All the Images and CSS are loaded perfectly as expected.

    However when I hosted the web site in IIS Server version 7.5 , CSS and Image files are not shown in the website.

    After a long research , Finally found that the Static Content handler is not enabled in the IIS Server.

    After Enabling Static content , issue got fixed. Now the Images and CSS are shown in the Website as expected.

    To Enable Static content Handler :

    1. Open Turn Windows Features On or Off
    2. Select Internet Information Services
    3. Then World Wide Web Services
    4. Under Common HTTP Features Check the Static Content,
    5. Click Ok.