Monday, January 9, 2012

When you install the 32-bit version of Microsoft ASP.NET 2.0 on a 64-bit computer, the ASP.NET state service (Aspnet_state.exe) is not installed.

This problem may occur when one of the following conditions is true:
  • You install only the 32-bit version of ASP.NET 2.0 on a 64-bit computer where Microsoft Internet Information Services (IIS) is already configured to run in Microsoft Windows on Windows 64 (WOW64) mode.
  • You uninstall the 64-bit version of ASP.NET 2.0 before you install the 32-bit version of ASP.NET 2.0.
 
To resolve this problem, install the 64-bit version of ASP.NET 2.0 before you install the 32-bit version of ASP.NET 2.0.

Note The information in this article applies only to 64-bit computers that are running the 32-bit version of ASP.NET 2.0 and IIS in WOW64 mode. Additionally, the following steps configure the computer to run the 32-bit version of ASP.NET 2.0 and IIS in WOW64 mode.

To resolve this problem, follow these steps:
  1. If you already installed the 32-bit version of ASP.NET 2.0 on the computer, run the following command to uninstall the 32-bit version of ASP.NET 2.0:
    Framework\v2.0.50727\aspnet_regiis -u
  2. Run the following command to switch IIS to run in native mode:
    cscript DriveLetter:\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32BitAppOnWin64 0
  3. Run the following command to install the 64-bit version of ASP.NET 2.0:
    Framework64\v2.0.50727\aspnet_regiis -i
  4. Run the following command to switch IIS to run in WOW64 mode:
    cscript DriveLetter:\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32BitAppOnWin64 1
  5. Run the following command to install the 32-bit version of ASP.NET 2.0:
    Framework\v2.0.50727\aspnet_regiis -i

Wednesday, December 28, 2011

how to create a proxy from webservice?

There are two ways to create proxy from web Service:

1. Add web reference in your web application and use them.


2. Open the command prompt of visual studio and copy & paste bellow mentioned line:

For VB
=====
wsdl /language:VB /n:"<destination>" http://<source&lgt;?WSDL

For C# 
=====
wsdl /language:CS /n:"<destination>" http://
<source&lgt;?WSDL

Friday, December 2, 2011

how to download a file

        Response.ContentType = "application/pdf";
        Response.AppendHeader("Content-Disposition", "attachment; filename=aaa-13.pdf");
        Response.TransmitFile(Server.MapPath("~/Image/UserDetails-13.pdf"));
        Response.End();

Thursday, November 24, 2011

How to Store Viewstate to Persistence Medium



In this article we will discuss about How to store ViewState of a Page/Control on server or a custom data store like sql server or file.
As you all know ViewState is stored as part of html sent to your browser in form of hidden field. This is the default behavior of asp.net framework. Starting asp.net 2.0 you have more control over how & where view state should be stored? First of all let’s understand the reason behind not sending viewstate to client:-
1.)    ViewState can be tempered with on client side with tools like firebug, fiddler etc.
2.)    ViewState makes page bulky and page loading process becomes slow.

Asp.net 2.0 introduced two methods which help us out in this process:-
1.)    LoadPageStateFromPersistenceMedium
2.)    SavePageStateToPersistenceMedium
LoadPageStateFromPersistenceMedium loads viewstate data from your custom storage.
SavePageStateToPersistenceMedium saves viewstate data to persistence medium.
So let’s try to understand this with an example
1.   Create an empty website in visual studio
2.   Add a page say Default.aspx
3.   Write below code in aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>title>
head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server">
asp:DropDownList>
td>
tr>
<tr>
<td>
<asp:TextBox ID="TextBox1" runat="server">asp:TextBox>
td>
tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
td>
tr>
table>
div>
form>
body>
html>

4. In code behind file write below code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<ListItem> items = new List<ListItem>();
items.Add(new ListItem("1"));
items.Add(new ListItem("2"));
items.Add(new ListItem("3"));
DropDownList1.DataSource = items;
DropDownList1.DataBind();
}
}
protected override object LoadPageStateFromPersistenceMedium()
{
if (Session["DefaultPageViewState"] != null)
{
       string viewStateString = Session["DefaultPageViewState"] as string;
TextReader reader = new StringReader(viewStateString);
LosFormatter formatter = new LosFormatter();
object state = formatter.Deserialize(reader);
return state;
}
else
return base.LoadPageStateFromPersistenceMedium();
//return null;
}
protected override void SavePageStateToPersistenceMedium(object state)
{
LosFormatter formatter = new LosFormatter();
StringWriter writer = new StringWriter();
formatter.Serialize(writer, state);
Session["DefaultPageViewState"] = writer.ToString();
}
}
Open page in browser and page loads up with values in dropdown list.



Right click page and click View Source. See highlighted portion below..The viewstate field is empty.

Click the button to perform postback. You will see the dropdown still loads with data i.e. ViewState has been persisted and is working fine.
Just to cross check if our code is actually working. Comment out code in LoadPageStateFromPersistenceMedium method and return null instead. Again compile and run the code. Page will open fine first time but now click on postback , you will see dropdown losing data since it was stored in viewstate.

Sunday, October 30, 2011

how to get name of procedure where word like tablename, column name have been used in Oracle

SQL> select distinct name from user_source where upper(type)='PROCEDURE' and upp
er(text) like '%TABLENAME%';

NAME
------------------------------
SP_ABC
SP_BCD
SP_XYZ
SP_LMD
SP_WEEK_ABC
SP_WEEK_XYZ

Friday, October 28, 2011

How to count no of rows in a Textarea in javascript

function rowcount()

var area = document.getElementById("hist");
var text = area.value.replace(/\s+$/g, "");
var split = text.split("\n");
return split.length;
}

Thursday, August 18, 2011

How to get that particular table is being used in any procedure, trigger etc...?

select * from user_source where upper(text) like '%REVENUE_EMP_DTLS_WEEK_REPORT%'