Friday, May 30, 2014

Remember Me at Login

0 comments
You can use Remember Me at 2 timeout values in the web.config file that are important for making the "Remember Me" functionality.
The first one is the FormsAuthentication.Timeout. This timeout is used to set expiration timestamp of the .ASPXAUTHcookie.

 
 

The second one is the HttpSessionState.Timeout. This time out is kept in the session manager or SQL table depends on which mode is configured.


 
          mode="InProc"
      cookieless="true"
      timeout="30" />
 
 

When a user visits the login page for the very first time, ASP.NET creates the ASP.NET_SessionId cookie.
If a cookie has expiration timestamp "Session", that cookie is stored only in the memory of the browser as described on MSDN about Writing Cookies.
If you do not set the cookie's expiration, the cookie is created but it is not stored on the user's hard disk. Instead, the cookie is maintained as part of the user's session information. When the user closes the browser or if the session times out, the cookie is discarded. A non-persistent cookie like this is handy for information that needs to be stored for only a short time or that for security reasons should not be written to disk on the client computer. For example, non-persistent cookies are useful if the user is working on a public computer, where you do not want to write the cookie to disk.
The ASP.NET_SessionId cookie is used by ASP.NET to map subsequent HTTP requests to the sameHttpContext.Session object on the server side. Indeed, this cookie is discarded and re-created for every HTTP request inCookieless Sessions mode.
When the cookieless attribute setting is false, the session-state module actually creates a cookie named ASP.NET_SessionId and stores the session ID in it...
A session cookie is given a very short expiration term and is renewed at the end of each successful request.
However, I could not confirm that this behavior still holds. In other words, the exact same cookie is re-used for every HTTP requests. A much more important point is that developers have no access to this cookie from C#. This means the "Remember Me" button on login page goes to another cookie.
And that is the .ASPXAUTH cookie.
When "Remember Me" option is selected, the .ASPXAUTH cookie will have an expiration timestamp explicitly set.
If a user select "Remember Me" option, then leave the system for an extended period of time. When he or she gets back to the system, the .ASPXAUTH cookie will NOT resume a previous session. Instead, a new session is created as if the user has put in the correct username and password again.
The "Remember Me" functionality provided by Microsoft will not be adaquate if the application needs to do more than matching username and password. For example: a multi tenant application needs the user to identify the client, database or table to log in. In this case, the application has to put extra information into the .ASPXAUTH cookie.
If you need to put extra information into this cookie, you need to take the following steps:
1. When you serve the login page, try to read the the .ASPXAUTH cookie. If the extra information could be read from the cookie, you can redirect the user away from login page to home page or other pages.
2. When the user submit login information, you need to put the extra information into the FormsAuthenticationTicket. See How to Add Custom Info to Authentication Cookies.
The login flow:

Wednesday, January 15, 2014

what is Responsive website design ?

0 comments
Responsive Design:
A responsive design is one which is compatible to all browsers,smartphones and Tablets etc. It can be seen same to all the environment.
Why to use Responsive Design ?
No need to invest further on Mobile app for smartphones or tablets one product for all the environment.



Friday, September 20, 2013

Inserting Data in a Database SQL through ASP.Net

0 comments


  • Step-1: Create ASP.NET Controls
  • Step-2: Create Database and Table in SQL Server
  • Step-3: Create Connection in web.config

Step-1

Initial UI with some fields

"">
"server">
     </code><code class="js keyword" style="margin: 0px; padding: 0px; border: 0px; vertical-align: top;"></code> <code class="js plain" style="margin: 0px; padding: 0px; border: 0px; vertical-align: top;">
    
"form1" runat="server">
    
    "width:900px; height:100px; vertical-align:top">
    
    
"width:600px; padding-left:200px">
    "padding-left:65px">id: 
        "TextBox1" runat="server">
        "padding-left:40px">Name:
        "TextBox2" runat="server">
        Designation:
        "TextBox3" runat="server">
        "padding-left:5px">Mobile_No:
        "TextBox4" runat="server">
        "padding-left:26px">Address:
        "TextBox5" runat="server">
        "Button1" runat="server" Text="Submit" onclick="Button1_Click"/>
        
    
    
    
     
    
    

Step-2


Now follow the following steps to create the table:

  1. Go on Server explorer open database.mdf and right click on table
  2. Create new table
  3. Now insert field as Id(Int), Name(varchar(50)), Designation(varchar(50)), Mobile_No(Int), Address(varchar(50)).

SQL Server Database Table with given Columns


C# Code Behind
using System.Data.SqlClient;
protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection cnn = new SqlConnection();
        cnn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["sqlconnection "].ConnectionString;
        cnn.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "select * from  TableName";
        cmd.Connection = cnn;
        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = cmd;
        DataSet ds = new DataSet();
        da.Fill(ds, " TableName ");
        SqlCommandBuilder cb = new SqlCommandBuilder(da);
        DataRow drow = ds.Tables["TableName"].NewRow();
        drow["id"] = TextBox1.Text;
        drow["Name"] = TextBox2.Text;
        drow["Designation"] = TextBox3.Text;
        drow["Mobile_No"] = TextBox4.Text;
        drow["Address"] = TextBox5.Text;
        ds.Tables["TableName "].Rows.Add(drow);
        da.Update(ds, " TableName ");
        string script = @";";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "myJScript1", script);
    }


Webconfig




"sqlconnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  
    


Wednesday, March 7, 2012

Google Checkout Integration

0 comments
Google provides sample code for using their Google Checkout .NET API versions 2.4 and earlier for order processing:
http://code.google.com/p/google-checkout-dotnet-sample-code/downloads/list
It's not fully featured sample code, but it should be enough to get you going without having to resort to dealing with XML directly.
Version 2.5 of the Google Checkout API no longer requires SSL/https for handling notifications. Google has not yet provided any .NET sample code for that scenario. Through trial and error, I created an ASP.NET MVC sample application that handles Google Checkout notifications from the 2.5 API:
http://www.capprime.com/software_development_weblog/2010/11/29/UsingTheGoogleCheckout25APIWithASPNETMVCTheMissingSample.aspx

How To implement Paypal in ASP.Net

0 comments
Please Follow The Instructions of the below Link
http://www.spiderweblogic.com/Paypal-Integration-Code.aspx

Features included:
  • Home page with a "Product List" that have links to add to cart
  • "View Cart" Page
  • "PayPal Checkout" Page with a link to checkout
  • One "master page" you can edit to get a desired look and feel across the website. 
These are designed for an ASP.Net developer.  If you are not an ASP.Net developer/coder, then this starter kit/sample code would be of no use to you.

Basic Steps
  1. Sign up for a PayPal account. They have personal, premier, and business accounts. You will need to upgrade to a premier or business account to accept credit cards.  PayPal is always happy to let you upgrade.
  2. Download the source code above
  3. Put in your PayPal email address in the SendPayPal.aspx page
  4. Tailor the Master Page to have the look desired
  5. Add your products to the xml file
  6. Add your pictures to the pictures folder

Thursday, January 26, 2012

Iphone Applications Survey

0 comments
According to the Latest Survey As it’s well known, right now Mobile App market is to boom worldwide – the total global incomes from mobile apps sales will reach $8,8 billion by 2015. According to the latest research, ОS Google Android and iOs have preoccupied 82% of the Mobile Apps market in the USA and right now a lot of companies that render IT services became mobile app market oriented.

Saturday, January 14, 2012

PHP $_Post

0 comments
The $_POST Variable

The predefined $_POST variable is used to collect values from a form sent with method="post".

Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

Note: However, there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file).
Example
Name:
Age:


When the user clicks the "Submit" button, the URL will look like this:
http://www.w3schools.com/welcome.php

The "welcome.php" file can now use the $_POST variable to collect form data (the names of the form fields will automatically be the keys in the $_POST array):
Welcome !

You are years old.

When to use method="post"?

Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

However, because the variables are not displayed in the URL, it is not possible to bookmark the page.
The PHP $_REQUEST Variable

The predefined $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE.

The $_REQUEST variable can be used to collect form data sent with both the GET and POST methods.
Example
Welcome !

You are years old.

Wednesday, June 15, 2011

Hypertext Transfer Protocol

2 comments
HTTP stands for Hypertext Transfer Protocol. It is an TCP/IP based communication protocol which is used to deliver virtually all files and other data, collectively called resources, on the World Wide Web. These resources could be HTML files, image files, query results, or anything else.
A browser is works as an HTTP client because it sends requests to an HTTP server which is called Web server. The Web Server then sends responses back to the client. The standard and default port for HTTP servers to listen on is 80 but it can be changed to any other port like 8080 etc.
There are three important things about HTTP of which you should be aware:
• HTTP is connectionless: After a request is made, the client disconnects from the server and waits for a response. The server must re-establish the connection after it process the request.
• HTTP is media independent: Any type of data can be sent by HTTP as long as both the client and server know how to handle the data content. How content is handled is determined by the MIME specification.
• HTTP is stateless: This is a direct result of HTTP's being connectionless. The server and client are aware of each other only during a request. Afterwards, each forgets the other. For this reason neither the client nor the browser can retain information between different request across the web pages.

Tuesday, June 14, 2011

Code to get MAC Id from client PC

0 comments
ManagementClass oMClass = new ManagementClass ("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection colMObj = oMCLass.GetInstances(); foreach(ManagementObject objMO in colMObj){Console.WriteLine(objMO["MacAddress"].ToString());}ManagementClass oMClass = new ManagementClass ("Win32_NetworkAdapterConfiguration");

ManagementObjectCollection colMObj = oMCLass.GetInstances();

foreach(ManagementObject objMO in colMObj)
{
Console.WriteLine(objMO["MacAddress"].ToString());
}

ScriptMaager and ScripManagerProxy

1 comments
ScriptManagerProxy - This class will be used when you wanted to use script manager in a usercontrol or content page where you already have script manager reference in your parent page.

ScriptManager - This class is used when you wanted to use Ajax control or libraries in your page for partial page post poct and rendering.

If you wanted to know more detials have a look at below MSDN article,

For ScriptManagerProxy
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanagerproxy.aspx
For ScriptManager
http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx