Tuesday, April 12, 2016


      
           
                 maxJsonLength="50000000"/>
           

Sunday, April 10, 2016

$("#bntSubmit").on('click', function (e) {

    // Initialize the object, before adding data to it.
    //  { } is declarative shorthand for new Object()
    var obj = {};
    obj.first_name = $("#txtFirstName").val();
    obj.last_name = $("#txtLastName").val();
    obj.qualification = $("#txtQualication").val();
    obj.age = $("#txtAge").val();

    //In order to proper pass a json string, you have to use function JSON.stringfy
    var jsonData = JSON.stringify(obj);

    $.ajax({
        url: 'myGenericHandler.ashx',
        type: 'POST',
        data: jsonData,
        success: function (data) {
            console.log(data);
            alert("Success :" + data);
        },
        error: function (errorText) {
            alert("Wwoops something went wrong !");
        }
    });

    e.preventDefault();
});

# Add Generic Handler ( ashx file) in your Asp.net Application.

 

using System.Web.Script.Serialization;
using System.IO;

 

 // we create a userinfo class to hold the JSON value
  public class userInfo
  {
     public string first_name { get; set; }
     public string last_name { get; set; }
     public string qualification { get; set; }
     public string age { get; set; }
  }

public void ProcessRequest(HttpContext context)
{
    context.Response.ContentType = "text/plain";
    try
    {
        string strJson = new StreamReader(context.Request.InputStream).ReadToEnd();

        //deserialize the object
        userInfo objUsr = Deserialize(strJson);
        if (objUsr != null)
        {
            string fullName = objUsr.first_name + " " + objUsr.last_name;
            string age = objUsr.age;
            string qua = objUsr.qualification;
            context.Response.Write(string.Format("Name :{0} , Age={1}, Qualification={2}", fullName, age, qua));
        }
        else
        {
            context.Response.Write("No Data");
        }
    }
    catch (Exception ex)
    {
        context.Response.Write("Error :" + ex.Message);
    }
}

 

<%@ WebHandler Language="C#" Class="myGenericHandler" %>

using System;
using System.Web;
using System.Web.Script.Serialization;
using System.IO;

public class myGenericHandler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        try
        {
            string strJson = new StreamReader(context.Request.InputStream).ReadToEnd();

            //deserialize the object
            userInfo objUsr = Deserialize(strJson);
            if (objUsr != null)
            {
                string fullName = objUsr.first_name + " " + objUsr.last_name;
                string age = objUsr.age;
                string qua = objUsr.qualification;
                context.Response.Write(string.Format("Name :{0} , Age={1}, Qualification={2}", fullName, age, qua));
            }
            else
            {
                context.Response.Write("No Data");
            }
        }
        catch (Exception ex)
        {
            context.Response.Write("Error :" + ex.Message);
        }
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

    // we create a userinfo class to hold the JSON value
    public class userInfo
    {
        public string first_name { get; set; }
        public string last_name { get; set; }
        public string qualification { get; set; }
        public string age { get; set; }
    }


    // Converts the specified JSON string to an object of type T
    public T Deserialize(string context)
    {
        string jsonData = context;

        //cast to specified objectType
        var obj = (T)new JavaScriptSerializer().Deserialize(jsonData);
        return obj;
    }

}

Wednesday, April 6, 2016

Introduction

This article explains how to download and install a default instance of Microsoft SQL Server 2008 R2 Express.

Instructions

Before proceeding, verify that you don't already have an instance of Microsoft SQL Server installed on the computer. If any edition (excluding the Compact Edition) of Microsoft SQL Server 2000 or later is already installed, you can use this existing installation with RealtyWare. Previous versions of Microsoft SQL Server may have to be updated or can be kept side-by-side with newer versions.
Follow these steps to download and perform a new default instance installation of Microsoft SQL Server 2008 R2 Express:
  1. Download Microsoft SQL Server 2008 R2 Express. There are 32-bit (x86, file name SQLEXPRWT_x86_ENU.exe) and 64-bit (x64, file name SQLEXPRWT_x64_ENU.exe) versions available for download. If you are unsure if your operating system is 64-bit, download the 32-bit version:

    Microsoft SQL Server 2008 R2 Express 32-bit (x86)
    - or -
    Microsoft SQL Server 2008 R2 Express 64-bit (x64)

    This download also includes basic management tools for the database server.

    Important: You may have to install Microsoft .Net Framework 3.5 SP1, Windows Installer 4.5 and Windows PowerShell 1.0 before installing Microsoft SQL Server 2008 R2 (typically required for Windows XP and Windows Server 2003).
  2. Open the downloaded file (SQLEXPRWT_x86_ENU.exe or SQLEXPRWT_x64_ENU.exe) to start the SQL Server Installation Center.
  3. Click on New installation or add features to an existing installation.
  4. Follow the installation wizard.
  5. When prompted for the Instance Configuration, select Default instance.
  6. Follow the installation wizard.
  7. When prompted for the Database Engine Configuration, it is recommended that you select Mixed Mode (SQL Server authentication and Windows authentication) and provide a strong password.
  8. Follow the installation wizard and wait until the installation is complete.
For security reasons, network access to the database server is disabled by default. Follow these steps to enable TCP/IP network access:
  1. Go to Start > All Programs > Microsoft SQL Server 2008 R2 > Configuration Tools > SQL Server Configuration Manager.
  2. Open the node SQL Server Network Configuration and select Protocols for MSSQLSERVER.
  3. Double-click on TCP/IP.
  4. Set Enabled to Yes.
  5. Click on OK.
  6. Close the SQL Server Configuration Manager.
  7. Restart the computer or the SQL Server service.

Wednesday, March 30, 2016

JSON.stringify

<script type="text/javascript">
    $(function () {
        $("[id*=btnSave]").bind("click", function () {
            var user = {};
            user.Username = $("[id*=txtUsername]").val();
            user.Password = $("[id*=txtPassword]").val();
            $.ajax({
                type: "POST",
                url: "Default.aspx/SaveUser",
                data: '{user: ' + JSON.stringify(user) + '}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    alert("User has been added successfully.");
                    window.location.reload();
                }
            });
            return false;
        });
    });
</script>

Tuesday, March 22, 2016

Tipsy jQuery Tooltip

See more:
http://1stwebmagazine.com/tipsy-jquery-tooltip
Demo:
http://1stwebmagazine.com/demo/tipsy-jquery-tooltip.html

Monday, January 25, 2016

Sunday, January 24, 2016

Thursday, January 21, 2016

The Problem

So, you’re trying to publish a desktop app via the Visual Studio 2010 Click Once publishing, and you’re having problems with Visual Studio 2010 Click Once publishing?  Are you getting errors like the part below
Following errors were detected during this operation.
* [2/22/2012 1:45:21 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
– Downloading http://www.Domain.com/PublishFiles/SomeApp/Application Files/ReportingApp_1_0_0_8/App_Data/Reporting.sdf.deploy did not succeed.
– Source: System.Deployment
– Stack trace:
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
— Inner Exception —
System.Net.WebException
– The remote server returned an error: (404) Not Found.
– Source: System
– Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
Even though you are not using a .sdf file

The Cause

Somewhere along the way you did have a .sdf file in the app_data folder, and the Click Once deploy manifest listed it. The manifest looks for it and does not find it, and would not find it anyway due to .sdf not being an accepted mime type on your server.

The Solution

Make sure that there are no .sdf files in the app_data folder, do a grep for any .sdf files, and then delete the web directories containing the files, the republish via click once

Thursday, December 17, 2015

Example:

 <system.web>
     <sessionState timeout="60"></sessionState>
  </system.web>
 
if not working, try this:
1,  go to IIS
2, Application Pools --> Advanced Setting 
--> change Time in Idle Time-out

--> Done!