Tuesday, December 15, 2015

FilE Upload Control not working After publishing .Net web application



1. In Inetmgr, Select Applicaton Pools.

2.  Click at Default AppPool, Select Advanced Settings

3. Set true to Enable 32 Bit Applications


Problem in uploading Excel File in Published ASP.NET website



  1. Open inetmgr
  2. Click at Application Pools
  3. Select DefaultAppPool, Select Advanced Settings.
  4. Set Enable 32 bit Applications to True
  5. Click at OK

Crystal Reports PDF Export Not Working


If the error is Object reference not set to the instance of an object, then possible reasons are:

a) File Name (Report) incorrect.

b) Stored Procedure Missing.

c) Fonts (Arial , Times New Roman ) changed due to Windows Update KB3102429.


In such a case copy these fonts from Old System  C-> Windows -> Fonts to current system Fonts folder. Restart the system and reports start working.




Wednesday, October 7, 2015

Wordpress - Fatal error: Maximum execution time of 30 seconds exceeded



I am downloading plugins etc in wordpress and getting the following error


Fatal error: Maximum execution time of 30 seconds exceeded in .................


Solved it by changing the value for the param max_execution_time in php.ini, like this:


  • max_execution_time = 360      ; Maximum execution time of each script, in seconds (I CHANGED THIS VALUE)
  • max_input_time = 120          ; Maximum amount of time each script may spend parsing request data
  • ;max_input_nesting_level = 64 ; Maximum input variable nesting level
  • memory_limit = 128M           ; Maximum amount of memory a script may consume (128MB by default)

Wednesday, September 23, 2015

SQL Server Query for Rank (RowNumber) and Groupings


In SQL Server select statement, to generate and restart Group wise Serial No. following SQL Statement can be used.

in the following statement

select 
        ProductCategory, 
row_number() over(partition by ProductCategory order by ProductCategory) AS SrNo,
        ItemName
from items
group by ProductCategory
order by ProductCategory


Tuesday, September 15, 2015

Enabling Windows GodMode



Microsoft Windows Vista (32-bit version) introduced a new hidden feature called GodMode that allows you to view and adjust all settings within Windows. To create a shortcut to the GodMode in Windows Vista (32-bit) or any version of Windows 7 follow the steps below.


  • Anywhere on your computer create a new folder.
  • After the folder has been created, copy the below text, rename that folder, and paste the text as the file name.


GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}


Once the above steps have been completed a new shortcut entitled GodMode will be visible. Opening this shortcut displays a Window similar to the example below.




Wednesday, April 22, 2015

Steps to configure crystal reports in published site in IIS

Steps to configure crystal reports in published site in IIS

1. Add Handler

Request Path - CrystalImageHandler.aspx
Type :- CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
Name :- CrystalImageHandler.aspx_GET

In Request restrictions
Deselect Invoke handler option.


2. Web.Config

In System.web , httphandlers section

<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />

In System.Webserver, handlers section

<add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode" />

3. Run msi for crystalreports

CRRedist2008_x64

4. In VS design open crystal report verify database, republish.

Monday, April 20, 2015

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.


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.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.


SOLUTION / FIX : 

the 64-bit framework dlls weren’t able to 32-bit versions of the 'Microsoft.ACE.OLEDB.12.0' provider modules.

If you are running Visual Studio on a 64-bit machine, IIS 7 is not (by default) serving 32-bit applications.

However, the database engine operated on 32-bit.

Follow these steps to fix the issue:

1.    Open the IIS 7.5 manager and select the application pool corresponding to your web application.
2.    Right click the application pool and select ‘Advanced settings’.
3.    Select the field ‘Enable 32-bit applications’ and change it to 'true'.
4.    Restart your application pool and access your application to fix the error you saw.



Monday, April 13, 2015

No mapping exists from object type System.Web.UI.WebControls.

I am getting the the message on the command:

commandObj.ExecuteNonQuery();

Complete message is:

No mapping exists from object type System.Web.UI.WebControls.TextBox to
a known managed provider native type.



Solution: its actually a very silly mistake 

Seems as if  you set the DataBinding on the TextBox/Label itself instead of the Text property of the TextBox/Label?

for Example: 

cmdInsert.Parameters.Add(new SqlParameter("@LastName", txtLastName));

Instead of
cmdInsert.Parameters.Add(new SqlParameter("@LastName", txtLastName.Text));

Wednesday, April 8, 2015

Send Email from Yahoo!, GMail, Hotmail (C#)

Server Parameters

Server NameSMTP AddressPortSSL
Yahoo!smtp.mail.yahoo.com587Yes
GMailsmtp.gmail.com587Yes
Hotmailsmtp.live.com587Yes

Sample Code

using System.Net;
using System.Net.Mail;
string smtpAddress = "smtp.mail.yahoo.com";
int portNumber = 587;
bool enableSSL = true;
string emailFrom = "fromEmailID@yahoo.com";
string password = "yourEmailPassword";
string emailTo = "someone@domain.com";
string subject = "Testing Email ";
string body = "Hello, I'm sending Email via Code ..." ;
using (MailMessage mail = new MailMessage())
{
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
 
    mail.Attachments.Add(new Attachment("C:\\SomeFile.txt"));
    mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));
    using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
    {
        smtp.Credentials = new NetworkCredential(emailFrom, password);
        smtp.EnableSsl = enableSSL;
        smtp.Send(mail);
    }
}