After setup .NET Framework 1.0 on windows 2008. When tring to browse any site, gave me error 500. Unable to load C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll.
After investigation I found solution to register Framework 4.0 again using command aspnet_regiis /i
Wednesday, December 29, 2010
Thursday, March 11, 2010
Fixing File Upload Size Limit in IIS 7
In the older IIS (IIS 6 or lower), adding the following code to in the web.config file in the web application’s folder Tallows a file upload of 2,000,000 kilobytes and it will time out after 100,000 seconds, or 27.8 hours.:
<httpruntime executiontimeout="100000" maxrequestlength="2000000">
To do this in IIS 7 on Windows 2008 Server add the following code toin the web.config file:
<security>
<requestfiltering>
<requestlimits maxallowedcontentlength="2000000000″>
</requestfiltering>
</security>
<httpruntime executiontimeout="100000" maxrequestlength="2000000">
To do this in IIS 7 on Windows 2008 Server add the following code to
<security>
<requestfiltering>
<requestlimits maxallowedcontentlength="2000000000″>
</requestfiltering>
</security>
Thursday, August 13, 2009
.NET Image Manipulation programmatically
Sometimes developer need to do image manipulation pro grammatically:
- Resizing the image width/height.
- Change image format.
- Decrease image quality to decrease image size.
- We will declare variable for new image width, height, Quality(1-100), extension.
- Create Bitmap from physical file or stream.
- Initialize new bitmap using new width and height.
- Initialize graphic from new image.
- Draw old image with new width and height to new image variable.
- Before we save image we need get encoder of its new type.
- Last step will save image with its new configurations:
|
|
|
|
EncoderParameters imgParams = new EncoderParameters(1); imgParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality,Quality); ImageCodecInfo ici = GetEncoderInfo(sMime); ImageCodecInfo newici = GetEncoderInfo(sNewMime); imgBitMap.Save(newstream, newici,imgParams); |
Wednesday, April 1, 2009
Javascript Get Page Height With Scroll
This javascript return width and height of a web page including the scroll.
function getSizeWithScroll()
{
if (window.innerHeight && window.scrollMaxY!=undefined)
{
// Firefox
yWithScroll = window.innerHeight + window.scrollMaxY;
xWithScroll = window.innerWidth + window.scrollMaxX;
}
else
{
var body = document.body;
if (body && body.parentElement=null&&body.parentElement.clientHeight)
{
height = body.parentElement.clientHeight;
htmlheight = body.parentElement.scrollHeight;
width = body.parentElement.clientWidth;
htmlwidth = body.parentElement.scrollWidth;
yWithScroll = height>htmlheight?height:htmlheight;
xWithScroll = height>htmlheight?width:htmlwidth;
}
else
if (body && body.clientHeight)
{
height = body.clientHeight;
htmlheight = body.scrollHeight;
width = body.clientWidth;
htmlwidth = body.scrollWidth;
yWithScroll = height>htmlheight?height:htmlheight;
xWithScroll = height>htmlheight?width:htmlwidth;
}
}
arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
return arrayPageSizeWithScroll;
}
There is another option using JQuery:
$(window).width(); //width without scroll
$(window).height(); //height without scroll
$(document).width(); //width with scroll
$(document).height();//height with scroll
function getSizeWithScroll()
{
if (window.innerHeight && window.scrollMaxY!=undefined)
{
// Firefox
yWithScroll = window.innerHeight + window.scrollMaxY;
xWithScroll = window.innerWidth + window.scrollMaxX;
}
else
{
var body = document.body;
if (body && body.parentElement=null&&body.parentElement.clientHeight)
{
height = body.parentElement.clientHeight;
htmlheight = body.parentElement.scrollHeight;
width = body.parentElement.clientWidth;
htmlwidth = body.parentElement.scrollWidth;
yWithScroll = height>htmlheight?height:htmlheight;
xWithScroll = height>htmlheight?width:htmlwidth;
}
else
if (body && body.clientHeight)
{
height = body.clientHeight;
htmlheight = body.scrollHeight;
width = body.clientWidth;
htmlwidth = body.scrollWidth;
yWithScroll = height>htmlheight?height:htmlheight;
xWithScroll = height>htmlheight?width:htmlwidth;
}
}
arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
return arrayPageSizeWithScroll;
}
There is another option using JQuery:
$(window).width(); //width without scroll
$(window).height(); //height without scroll
$(document).width(); //width with scroll
$(document).height();//height with scroll
Thursday, March 5, 2009
ODBC on 64 bit machine (Windows/VISTA)?
As we all database developers know that a ODBC DSN is an entry that we created through "ODBC Data Source Administrator" that we reached from Start/Control Panel/AdministrativeTools or typing "odbcad32" from Start/Run .
On a 64bit machine when you run "ODBC Data Source Administrator" and created an ODBC DSN, actually you are creating an ODBC DSN which can be reachable by 64 bit applications only(You will not see most of drivers).
To run your 32bit application on a 64 bit machine, You need to run the 32bit version of "odbcad32.exe" by running "c:\Windows\SysWOW64\odbcad32.exe" from Start/Run menu and create your ODBC DSN with this tool.
The key point here to remember is a 64bit machine should be considered as a "64 bit Windows + 32 bit Windows" at the sametime. That's why the folder that our developers put the 32bit "odbcad32.exe" under C:\Windows\SysWOW64\ . The WOW abbreviation here means "Windows on Windows"
Look at the C:\Windows\SysWOW64\ for the EXE files at least to know what sort of other EXEs/DLLs are also compiled as 32bit and shipped within your 64bit OS.
For example cscript.exe and wscript.exe are ther for your WSH (Windows Scripting Host) scripts which needs to be run as 32bit. Think about a scenario like that. Only the 32 bit version of the OLE DB Provider or ODBC Driver exists for the data source that you need to get the data from your VBScript code. If it's the case, you'll need create the ODBC DSN (assuming that you're going to use ADO + ODBC in your VBScript code) from C:\Windows\SysWOW64\odbcad32.exe and also you should call your script as
"C:\Windows\SysWOW64\wscript.exe C:\scripts\myscript.vbs".
Doubleclicking the myscript.vbs from the Windows Explorer will result your script to be executed as
"C:\Windows\System32\wscript.exe C:\scripts\myscript.vbs".
On a 64bit machine when you run "ODBC Data Source Administrator" and created an ODBC DSN, actually you are creating an ODBC DSN which can be reachable by 64 bit applications only(You will not see most of drivers).
To run your 32bit application on a 64 bit machine, You need to run the 32bit version of "odbcad32.exe" by running "c:\Windows\SysWOW64\odbcad32.exe" from Start/Run menu and create your ODBC DSN with this tool.
The key point here to remember is a 64bit machine should be considered as a "64 bit Windows + 32 bit Windows" at the sametime. That's why the folder that our developers put the 32bit "odbcad32.exe" under C:\Windows\SysWOW64\ . The WOW abbreviation here means "Windows on Windows"
Look at the C:\Windows\SysWOW64\ for the EXE files at least to know what sort of other EXEs/DLLs are also compiled as 32bit and shipped within your 64bit OS.
For example cscript.exe and wscript.exe are ther for your WSH (Windows Scripting Host) scripts which needs to be run as 32bit. Think about a scenario like that. Only the 32 bit version of the OLE DB Provider or ODBC Driver exists for the data source that you need to get the data from your VBScript code. If it's the case, you'll need create the ODBC DSN (assuming that you're going to use ADO + ODBC in your VBScript code) from C:\Windows\SysWOW64\odbcad32.exe and also you should call your script as
"C:\Windows\SysWOW64\wscript.exe C:\scripts\myscript.vbs".
Doubleclicking the myscript.vbs from the Windows Explorer will result your script to be executed as
"C:\Windows\System32\wscript.exe C:\scripts\myscript.vbs".
Sunday, March 1, 2009
LINQ to SQL and multiple result sets in Stored Procedures
When you want to use stored procedure return multiple results you can't depend on auto generated class. You must do it manually, following steps below:
1. Create Entities for returned types:
example: we will create 2 entities ACCOUNT, ACCOUNT_USERS to LINQ to SQL Data Context
2. Create Partail class inherited from LINQ to SQL Data Context and add your method as below:
example for stored procedure will be test.
public partial class DataClasses1DataContext
{
[Function(Name = "dbo.Test")]
[ResultType(typeof(ACCOUNT))]
[ResultType(typeof(ACCOUNT_USER))]
public IMultipleResults Test([Parameter(DbType = "Int")] System.Nullable tmp)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), tmp);
return ((IMultipleResults)(result.ReturnValue));
}
}
3. Now you can use this method as below
DataClasses1DataContext c = new DataClasses1DataContext();
var r = c.Test(null); ;
ACCOUNT a = r.GetResult();
c.Dispose();
1. Create Entities for returned types:
example: we will create 2 entities ACCOUNT, ACCOUNT_USERS to LINQ to SQL Data Context
2. Create Partail class inherited from LINQ to SQL Data Context and add your method as below:
example for stored procedure will be test.
public partial class DataClasses1DataContext
{
[Function(Name = "dbo.Test")]
[ResultType(typeof(ACCOUNT))]
[ResultType(typeof(ACCOUNT_USER))]
public IMultipleResults Test([Parameter(DbType = "Int")] System.Nullable
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), tmp);
return ((IMultipleResults)(result.ReturnValue));
}
}
3. Now you can use this method as below
DataClasses1DataContext c = new DataClasses1DataContext();
var r = c.Test(null); ;
ACCOUNT a = r.GetResult
c.Dispose();
Thursday, February 12, 2009
Installing Multiple Instances of Windows Service
To Installing Multiple Instances of Windows Service.
- Install InstallUtil.exe.
- Add a /name parameter to specify what the service will be named. The names have to be unique, so if you already have "Telligent Mail Gateway", you might need to name it "Telligent Mail Gateway - Site 2".
- Specify the filename of the Windows Service, which is usually like "....Service.exe”. With Mail Gateway.
it would be like this:
InstallUtil /name="Telligent Mail Gateway - Site 2" Service.Service.exe
Run this from a command prompt within the add-ons directory. The name must be in quotes if it contains spaces and must come before the filename.
Uninstalling the service is very similiar to installing. You will still use the InstallUtil.exe program and will need to specify the name of the service to uninstall, though this time you will need to add a /u switch to specify that you intend to uninstall it. For instance:
InstallUtil /u /name="Telligent Mail Gateway - Site 2" Service.Service.exe
The name must be specified since if you have multiple instances of the same executable installed, it will need to know which one. If no name is specified, it will remove the one with the default name as opposed to a custom named one.
Again, the uninstall and name parameters must come before the filename so that it know they are for that file.
Subscribe to:
Posts (Atom)