Showing posts with label Visual Studio2008. Show all posts
Showing posts with label Visual Studio2008. Show all posts

How to Setup SEO Friendly 301 Redirect?

Sunday, October 27, 2013



SEO Friendly 301 

The “301 Permanent Redirect” is the most efficient and search engine friendly method for redirecting websites. You can use it in several situations, including:

• to redirect an old website to a new address
• to setup several domains pointing to one website
• to enforce only one version of your website (www. or no-www)
• to harmonize a URL structure change

There are several ways to setup a 301 Redirect; below I will cover the most used ones:
PHP Single Page Redirect
In order to redirect a static page to a new address simply enter the code below inside the index.php file.
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http: // www . newdomain . com / page.html");
exit();
?>
PHP Canonical Redirect
The Canonical 301 Redirect will add (or remove) the www . prefixes to all the pages inside your domain. The code below redirects the visitors of the http: // domain . com version to http: // www. domain.com.
<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST']
.$_SERVER['REQUEST_URI']);
}
?>
Apache .htaccess Singe Page Redirect
In order to use this method you will need to create a file named .htaccess (not supported by Windows-based hosting) and place it on the root directory of your website, then just add the code below to the file.
Redirect 301 /old/oldpage.htm /new/http : // www .domain. com/newpage.htm
Apache .htaccess Canonical Redirect
Follow the same steps as before but insert the code below instead (it will redirect all the visitors accessinghttp://domain.com/ to http://www.domain.com/)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http:// www . domain .com/$1 [r=301,nc]
ASP Single Page Redirect
This redirect method is used with the Active Server Pages platform.
<%
Response.Status="301 Moved Permanently"
Response.AddHeader='Location','http://www . new-url . com/'
%>
ASP Canonical Redirect

The Canonical Redirect with ASP must be located in a script that is executed in every page on the server before the page content starts.
<%
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www."
& Request.ServerVariables("HTTP_HOST")
& Request.ServerVariables("SCRIPT_NAME")
End if
%>

Simple web browser in c#

Sunday, March 10, 2013








Pretty Simple no need to code bundle of lines for it, Just Drag n Drop Here all Done...

Lets Start

Create New project

      


Second Step is to Select Button From Tollbar





Third Step is to Drag TextField from ToolBar





Fourth Step is to drag Web Control From Toolbar






Next Step is Code .Cs file for in click event of Button, Double click on the Button and place these lines of code there


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Web_Broweser_tut
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.Navigate(textBox1.Text);
        }
    }
}



Removing blogger bar from blog

Sunday, March 3, 2013






Removing blogger bar from the top of the blog

it is possible intwo ways

--->  one is that you have your own hosting then it'll be no more on the top of the blog

---> second is that we can hide it by using  CSS properties

First step :

Go to select Template



Second Step : 

Select Edit  HTML

Then Paste this code in Code

#navbar {
height: 0px;
visibility: hidden;
display: none;
} 

That's it ...

Retrive Data from DataBase Using DataAdapter

Saturday, February 23, 2013









                 
First of all you need to create a new project, Here I am using Visual Studio 2008






Secod step is to start Select the type of project, I am going to Select
   --  Windows Forms Application




Now we will see something like this Called form




Third Step is to Design the Form

--- First Select button from Toolbar
--- Second Select List View from Toolbar




---Resize As you want to show on form
---Select View as you need, Here I select Detail


After that Click on ADD and edit text as you want to present on header of ListView





Here all the Setting is complete Next Task is to CODE the cs File

Here is the Code


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;

namespace List_view
{
    public partial class Form1 : Form
    {
        public SqlCeConnection con = new SqlCeConnection(@"Connection string ");
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Shown(object sender, EventArgs e)
        {
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());

            }
        }


        private void PopulateList_Click(object sender, EventArgs e)
        {

            listView1.Items.Clear();
            SqlCeCommand cmd2 = new SqlCeCommand("Select * from Login", con);
            SqlCeDataAdapter da = new SqlCeDataAdapter(cmd2);

            try
            {

                DataTable table = new DataTable();
                da.Fill(table);
                foreach (DataRow dr in table.Rows)
                {
                    ListViewItem item = new ListViewItem(dr["id"].ToString());
                    item.SubItems.Add(dr["password"].ToString());
                    listView1.Items.Add(item);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

        }

        private void ClearList_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();
        }

    }
}

 

Most Reading