Saturday, November 21, 2015

Fix loosing session automatically

A number of things can cause session state to mysteriously disappear.

    Your sessionState timeout has expired
    You update your web.config or other file type that causes your AppDomain to recycle
    Your AppPool in IIS recycles
    You update your site with a lot of files, and ASP.NET proactively destroys your AppDomain to recompile and preserve memory.

-

If you are using IIS 7 or 7.5, here are a few things to look for:

    By default, IIS sets AppPools to turn themselves off after a period of inactivity.
    By default, IIS sets AppPools to recycle every 1740 minutes (obviously depending on your root configuration, but that's the default)
    In IIS, check out the "Advanced Settings" of your AppPool. In there is a property called "Idle Time-out". Set that to zero or to a higher number than the default (20).
    In IIS, check the "Recycling" settings of your AppPool. Here you can enable or disable your AppPool from recycling. The 2nd page of the wizard is a way to log to the Event Log each type of AppPool shut down.

Friday, September 25, 2015

To call a webpage or webservice from stored procedure

First of all run following queries with sys admin rights:
sp_configure 'show advanced options', 1
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1
GO
RECONFIGURE;
GO
sp_configure 'show advanced options', 1
GO
RECONFIGURE;

After successful call then run following query:
Declare @Object as Int;
Declare @ResponseText as Varchar(8000);

Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
Exec sp_OAMethod @Object, 'open', NULL, 'get',
                 'http://[domain name]/abc.aspx', --Your Web Service Url (invoked)
                 'false'
Exec sp_OAMethod @Object, 'send'
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

Select @ResponseText

Exec sp_OADestroy @Object

Tuesday, September 22, 2015

Formatting problem with pdf

In telerik export to pdf I faced very different problem with formatting. One of my report on a server and on local end working fine, but on new server it was not working.
On digging to the issue I have found that difference of MS-Office on both server, older one have MS-office 2010 and newer one have another version, then I found that there is absence of font that I set in pdf file. It was Gloucester font.
Later I have installed it separately on windows server, everything works greatly