Wednesday, December 9, 2009

JD Edwards Create IItem BP/ Cost and location using SQL-server

Insert data in JD Edwards E1 tables create Item branch F4102 , Item Location F41021 and item cost F4105 using sql-server.

create proc insert_IM_BP_CO as
declare @fmcu varchar(12)
declare @tmcu varchar(12)
set @fmcu='SOUTHAFRICA'
set @tmcu=' SAFRICA-INT'
drop table jde_rk.dbo.mar021
select * into jde_rk.dbo.mar021 from proddta.f41021 where ltrim(limcu) =@fmcu and lipqoh<>0 and lipbin='P'
update jde_rk.dbo.mar021 set limcu =@tmcu ,lipqoh=0,lipcom=0,lilrcj=0, liuser='SQL-SERVER',liupmj=109343
-----------------------------------------------
drop table jde_rk.dbo.mar02
select * into jde_rk.dbo.mar02 from proddta.f4102 where ibitm in(select liitm from jde_rk.dbo.mar021)
and ltrim(ibmcu) =@fmcu
update jde_rk.dbo.mar02 set IBmcu =@tmcu , ibuser='SQL-SERVER',IBupmj=109343
------------------------------
drop table jde_rk.dbo.mar05

select * into jde_rk.dbo.mar05 from proddta.f4105
where coitm in(select liitm from jde_rk.dbo.mar021) and ltrim(comcu) =@fmcu
update jde_rk.dbo.mar05 set comcu =@tmcu , couser='SQL-SERVER',coupmj=109343
-------
insert into proddta.f41021
select * from jde_rk.dbo.mar021
insert into proddta.f4102
select * from jde_rk.dbo.mar02
insert into proddta.f4105
select * from jde_rk.dbo.mar05

Friday, October 23, 2009

Search Engine Optimization with ASP.NET 4.0, Visual Studio 2010 and IIS7

http://msdn.microsoft.com/en-us/magazine/ee405899.aspx


Sent from my iPhone

My iphone weather location is showing on Cupertino and New York. how to change this?

My iphone weather location is showing on Cupertino and New York. how to change this?

Open up the weather app and in the bottom right corner there is an i. Press the i and the page will flip allowing you to change the locations.

Sunday, October 11, 2009

Invitation to connect on LinkedIn

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- Rajeev

Confirm that you know Rajeev Kumar

Every day, millions of professionals like Rajeev Kumar use LinkedIn to connect with colleagues, find experts, and explore opportunities.

© 2009, LinkedIn Corporation

Monday, October 5, 2009

AJAX Accordion Control DataBinding and Gridview with Code Behind C#

AJAX Accordion Control DataBinding and Gridview with Code Behind C#


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!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>Untitled Page</title>
    <style type="text/css">.acc-header, .acc-selected {width: 300px;background-color: #c0c0c0;margin-bottom:2px;padding:2px;color:#444444;font-weight:bold;cursor:pointer;}.acc-content {width:300px;margin-bottom:2px;padding:2px;}.acc-selected, .acc-content {border:solid 1px #666666;}
</style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<ajaxToolkit:Accordion ID="Accordion1" runat="server" TransitionDuration="100" FramesPerSecond="200"
FadeTransitions="true" RequireOpenedPane="false" OnItemDataBound="Accordion1_ItemDataBound"
    ContentCssClass="acc-content" HeaderCssClass="acc-header" HeaderSelectedCssClass="acc-selected">
    <HeaderTemplate>
        <%#DataBinder.Eval(Container.DataItem,"categoryName") %>
    </HeaderTemplate>
    <ContentTemplate>
        <asp:HiddenField ID="txt_categoryID" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"categoryID") %>' />
        <asp:GridView ID="GridView1" runat="server" RowStyle-BackColor="#ededed" RowStyle-HorizontalAlign="Left"
            AutoGenerateColumns="false" GridLines="None" CellPadding="2" CellSpacing="2"
            Width="300px">
            <Columns>
                <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Product Name"
                HeaderStyle-BackColor="#d1d1d1"  HeaderStyle-ForeColor="#777777">
                    <ItemTemplate>
                        <%#DataBinder.Eval(Container.DataItem,"productName") %>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </ContentTemplate>
</ajaxToolkit:Accordion>

    </div>
    </form>
</body>
</html>

 

using System;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default7 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            getCategories();
        }
    }

    public void getCategories()
    {
        SqlConnection sqlConn = new SqlConnection(conString);
        sqlConn.Open();
        SqlCommand sqlSelect = new SqlCommand("SELECT * FROM Categories", sqlConn);
        sqlSelect.CommandType = System.Data.CommandType.Text;
        SqlDataAdapter sqlAdapter = new SqlDataAdapter(sqlSelect);
        DataSet myDataset = new DataSet();
        sqlAdapter.Fill(myDataset);
        sqlConn.Close();
        Accordion1.DataSource = myDataset.Tables[0].DefaultView;
        Accordion1.DataBind();

    }

    protected void Accordion1_ItemDataBound(object sender, AjaxControlToolkit.AccordionItemEventArgs e)
    {
        if (e.ItemType == AjaxControlToolkit.AccordionItemType.Content)
        {
            SqlConnection sqlConn = new SqlConnection(conString);
            sqlConn.Open();
            SqlCommand sqlSelect = new SqlCommand("SELECT productName FROM Products where categoryID = '" + ((HiddenField)e.AccordionItem.FindControl("txt_categoryID")).Value + "'", sqlConn);
            sqlSelect.CommandType = System.Data.CommandType.Text;
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(sqlSelect);
            DataSet myDataset = new DataSet();
            sqlAdapter.Fill(myDataset);
            sqlConn.Close();
            GridView grd = new GridView();
            grd = (GridView)e.AccordionItem.FindControl("GridView1");
            grd.DataSource = myDataset;
            grd.DataBind();
        }
    }


    private string conString
    {
        get
        {
            string connectionString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
            return connectionString;
        }
    }
}

Reference:: http://programming.top54u.co

Thursday, September 3, 2009

Sending SMS using asp.net - ASP.NET Forums

Sending SMS using asp.net - ASP.NET Forums

Visual Studio 2010 download asp.net 4.0 C# vb

Microsoft Visual Studio 2010 First Look

Download link:
http://www.microsoft.com/downloads/details.aspx?FamilyID=75cbcbcd-b0e8-40ea-adae-85714e8984e3&displaylang=en

ASP.NET Session State Overview

ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session. By default, ASP.NET session state is enabled for all ASP.NET applications.
Alternatives to session state include the following:
Application state, which stores variables that can be accessed by all users of an ASP.NET application.
Profile properties, which persists user values in a data store without expiring them.
ASP.NET caching, which stores values in memory that is available to all ASP.NET applications.
View state, which persists values in a page.
Cookies.
The query string and fields on an HTML form that are available from an HTTP request.
read more ASP.NET Session State Overview

Monday, August 31, 2009

Use Office 2007 OCR Using C#

CodeProject: How To: Use Office 2007 OCR Using C#. Free source code and programming help

What is OCR ?
OCR (Optical Character Recognition) is the recognition of printed or written text characters by a computer. This involves photoscanning of the text character-by-character, analysis of the scanned-in image, and then translation of the character image into character codes, such as ASCII, commonly used in data processing.
Or, we can say... Optical character recognition (OCR) translates images of text, such as scanned documents, into actual text characters. Also known as text recognition, OCR makes it possible to edit and reuse the text that is normally locked inside scanned images. OCR works using a form of artificial intelligence known as pattern recognition, to identify individual text characters on a page, including punctuation marks, spaces, and ends of lines.

Displaying Jquery Progress using ASP.NET MVC with Ajax

CodeProject: Displaying Jquery Progress using ASP.NET MVC with Ajax. Free source code and programming help

CodeProject: Reorderable ListView. Free source code and programming help

CodeProject: Reorderable ListView. Free source code and programming help

Friday, August 21, 2009

Access a Web service in a Windows-based application by using Visual Basic 2005

In Solution Explorer, right-click ServiceConsumer, and then click Add Web Reference.
after that add in your application.

Imports YourApplicationName.WEBserviceName VB
using WindowsApplication3.ElementExpress; c#




How to access a Web service in a Windows-based application by using Visual Basic 2005 or Visual Basic .NET

Tuesday, August 18, 2009

Sample Convert Number to Hours, Minutes in SQL Server

Convert Number to Hours and Minutes in SQL Server
SELECT pntotim/60 " hours ", pntotim % 60 " minutes" ,* FROM sATINOUT

Monday, August 17, 2009

Calculate Date Time difference in asp.net c#

Calculate Date time difference in asp.net c#
 
TimeSpan tmspan = DateTime.Parse(DateTime.Now.ToString()).Subtract(DateTime.Parse(YourTime.Text));

Response.Write(tmspan.Hours);

Response.Write("<br>");

Response.Write(tmspan.Minutes);

Response.Write("<br>");

Response.Write(tmspan.TotalHours);

Response.Write("<br>");

Response.Write(tmspan.TotalMinutes);

Friday, August 14, 2009

Retrieving Data Using the DataReader C# Asp.net

void loaddata()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
char stus = "N";
string strSQL = "select * FROM sATINOUT WHERE PNEMPID=" + Session["Udid"] + " and PNSTUS=" + stus;
SqlCommand cmd = new SqlCommand(strSQL, myConnection);
myConnection.Open();
SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (myReader.HasRows)
{
while (myReader.Read())
{
TxtUSERid.Text = myReader["UDUSRID"].ToString();
txtpasswd.Text = myReader["UDPASSWD"].ToString();
}
}
myReader.Close();
myConnection.Close();
}


Retrieving Data Using the DataReader

Thursday, July 30, 2009

Different ways of reading and writing text file data in .NET

Different ways of reading and writing text file data in .NET

Dynamically Generate Meta Tags for ASP.NET Pages using LINQ To XML

Dynamically Generate Meta Tags for ASP.NET Pages using LINQ To XML

Url Rebasing in ASP.NET 2.0

Url Rebasing in ASP.NET 2.0: ASP Alliance: "Url Rebasing"

Let’s say we have an image control with relative path on the masterpage html, and Masterpage is in one folder and the content page is in different folder. The relative image path given in the masterpage html markup points to the wrong location and the image is not rendered. To avoid these sorts of problems Asp.Net rebases relative urls known as Url Rebasing.

Thursday, July 23, 2009

Rss Feed to Listview with DataPager in Asp.net

Displaying Rss Feed in  Listview also using DataPager in Asp.net sample.
 
 
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="feedtolistview.aspx.cs" Inherits="feedtolistview" %>

<!

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 id="Head1" runat="server">

<title>Using DataPager and ListView Controls with a Custom Data Source</title>

</

head>

<

body>

<form id="form1" runat="server">

<div>

<asp:DataPager ID="dataPager" runat="server" PagedControlID="listItems" QueryStringField="page"

PageSize="5" >

<Fields>

<asp:NextPreviousPagerField FirstPageText="&lt;&lt;" ShowFirstPageButton="True"

ShowNextPageButton="False" ShowPreviousPageButton="False" />

<asp:NumericPagerField />

<asp:NextPreviousPagerField LastPageText="&gt;&gt;" ShowLastPageButton="True"

ShowNextPageButton="False" ShowPreviousPageButton="False" />

</Fields>

</asp:DataPager>

<br />

<asp:ListView ID="listItems" runat="server" DataSourceID="xmlDataSource">

<LayoutTemplate>

<asp:PlaceHolder runat="server" ID="itemPlaceholder" />

</LayoutTemplate>

<ItemTemplate>

<h3><a href="<%# XPath("link") %>"><%# XPath("title") %></h3> </a>

<%

# XPath("description")%>

</ItemTemplate>

<ItemSeparatorTemplate>

<hr />

</ItemSeparatorTemplate>

</asp:ListView>

<asp:XmlDataSource ID="xmlDataSource" runat="server" DataFile="http://rss.news.yahoo.com/rss/topstories"

XPath="rss/channel/item"></asp:XmlDataSource>

<asp:DataPager ID="dataPager1" runat="server" PagedControlID="listItems" QueryStringField="page"

PageSize="5">

<Fields>

<asp:NumericPagerField />

</Fields>

</asp:DataPager>

</div>

</form>

</

body>

</

html>

Friday, July 17, 2009

Find String within string C#

int FirstChr = MainString.IndexOf(SearchString);
 

Thursday, July 16, 2009

Date formating at gridview

DataFormatString

="{0:dd-MM-yyyy}"

Connection string based on the Database Environment c#

 Connection string based on the Database Environment c# sample:
 
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">

</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

ProviderName="System.Data.SqlClient"

DataSourceMode="DataReader"

SelectCommand="SELECT * FROM [mntsold]"></asp:SqlDataSource>

</div>

</form>

</

body>
</
html>
 

using

System;

using

System.Data;

using

System.Configuration;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

public

partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (System.Environment.GetEnvironmentVariable("COMPUTERNAME").ToString() == "xxxxxxx")

{

Response.Write(

"from test database");

SqlDataSource1.ConnectionString =

ConfigurationManager.ConnectionStrings["JDE_RKConnectionString"].ConnectionString;

}

if (System.Environment.GetEnvironmentVariable("COMPUTERNAME").ToString() == "ITWEB1223")

{

Response.Write(

"from production database");

SqlDataSource1.ConnectionString =

ConfigurationManager.ConnectionStrings["JDE_PRODUCTIONConnectionString"].ConnectionString;

}

 

}

}

SQLdatasource Connection String in code behind c#

<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">

</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

ProviderName="System.Data.SqlClient"

DataSourceMode="DataReader"

SelectCommand="SELECT * FROM [mntsold]"></asp:SqlDataSource>

code behind:

SqlDataSource1.ConnectionString =

ConfigurationManager.ConnectionStrings["JDE_PRODUCTIONConnectionString"].ConnectionString;

web.config

<

connectionStrings>

<

add name="JDE_PRODUCTIONConnectionString" connectionString="Data Source=ENTERPRISE;Initial Catalog=JDE_PRODUCTION;User ID=sssss;password=sssss"

providerName="System.Data.SqlClient" />

</
connectionStrings>



Machine Name in code behind C#

string name = System.Environment.GetEnvironmentVariable("COMPUTERNAME");

Wednesday, July 8, 2009

Find the SQL Server CD key Installed in your PC Using SQL command

USE master
EXEC xp_regread 'HKEY_LOCAL_MACHINE',
                'SOFTWARE\Microsoft\Microsoft SQL Server\80\registration', 
                 'CD_KEY'

Tuesday, July 7, 2009

Selecting unique node in a RSS feed base on user selection using c# asp.net

Selecting unique node in a RSS feed base on user selection using  c# asp.net

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default10.aspx.cs" Inherits="Default10" %>
<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:GridView ID="bank" Runat="server" DataSourceID="xds" AutoGenerateColumns="false" AllowPaging="True"  >
<Columns>

<asp:TemplateField>   
<ItemTemplate>       
<%# Container.DataItemIndex + 1 %>   
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
       <a href='Default10.aspx?url1=<%# Container.DataItemIndex + 1 %>'  >
          <%#XPath("title")%></a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:XmlDataSource ID="xds" Runat="server" DataFile="http://rss.news.yahoo.com/rss/topstories"
>
</asp:XmlDataSource>
   
    </div>
    </form>
</body>
</html>

code behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default10 : System.Web.UI.Page
{
    string strURL;
    protected void Page_Load(object sender, EventArgs e)
    {
       // Response.Write(Request["url1"].ToString());

        if (Request["url1"] == null)
        {
            xds.XPath = "rss/channel/item [position()>=0]";
            //strURL = "1";
        }
        else
        {
            //xds.XPath = "rss/channel/item [position()=" + Request["url"] + "]";
            strURL = Request["url1"];
            xds.XPath = "rss/channel/item [position()=" + strURL + "]";
        }

       

    }
}

Add items in menu by role with fine cut - JD Edwards E1

Master view ->click on fine cut-> click on blank space and select view by role-> select the role

and add menu item -> after that agaion change the role to admin-> click on fine cut

RSS feed particular Item display in a gridview

<div>

<asp:GridView ID="bank" Runat="server" DataSourceID="xds" AutoGenerateColumns="False" AllowPaging="True" >

<

Columns>

<

asp:TemplateField>

<

ItemTemplate>

<asp:HyperLink ID="HyperLink1" Runat="server" Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link") %>'

Target="_blank" Font-Names="Verdana" Font-Size="X-Small">

</asp:HyperLink>

</

ItemTemplate>

</

asp:TemplateField>

</

Columns>

</

asp:GridView>

<

asp:XmlDataSource ID="xds" Runat="server" DataFile="http://rss.news.yahoo.com/rss/topstories"

XPath

="rss/channel/item [position()=2]">

</

asp:XmlDataSource>

</div>

Thursday, July 2, 2009

Compiler Error CS1705

Compiler Error CS1705

Auto Page refresh Sample Using C#, Ajax

Auto Page refresh Sample Using  C#, Ajax
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="autoreferesh.aspx.cs" Inherits="autoreferesh" %>

<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
     <asp:Label ID="Label2" runat="server" Text="This is Time, When The Full Page Load :" Font-Bold="true"></asp:Label>&nbsp;
     <asp:Label ID="MyLabel" runat="server"></asp:Label><br /><br />       
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="30000">
            </asp:Timer>
        </div>
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
                <asp:Label ID="Label3" runat="server" Text="This is The Time when Page will Referesh :" Font-Bold="true"></asp:Label>&nbsp;
                <asp:Label ID="Label1" runat="server" Text="Page not refreshed yet."></asp:Label><br />
                <asp:Label ID="Label4" runat="server" Text="(Page Will Referesh after Every 30 Sec)" Font-Bold="true"></asp:Label>&nbsp;
                <br /><br />
            </ContentTemplate>
        </asp:UpdatePanel>     
    </form>
</body>
</html>

code behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class autoreferesh : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MyLabel.Text = System.DateTime.Now.ToString();
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    {

        Label1.Text = "Page Refreshed at: " + DateTime.Now.ToLongTimeString();

    }


}

Friday, June 26, 2009

Quotation in where condition sql-server

quotation in where condition sql-server

SELECT * FROM zzzzz WHERE zzzz = 'ZZzZ'cccc' change it
to SELECT * FROM zzzzz WHERE zzzz = 'ZZzZ''cccc'

Windows 7 Upgrade

Windows 7 is the easiest, fastest, and most engaging version of Windows yet. Better ways to find and manage files, like Jump Lists and improved taskbar previews, help you speed through everyday tasks. Faster and more reliable performance means your PC just works the way you want it to. And great features like Windows Media Center and Windows Touch make new things possible. Get to know Windows 7, and see how it can simplify just about everything you do with your PC.

Windows 7 will be available on October 22. It includes tons of little refinements—
and a few big ones—many suggested by you. The result? Everyday computing is
faster, simpler, easier.
Order Now Your Upgrade Version Save more then $100.

Windows7 Home Premium Upgrade

Windows7 Professional Upgrade

Wednesday, June 24, 2009

Twitter asp.net 2.0, C# sample

I created following application to post in Twitter by using twitter apis..in asp.net 2.0, C#
 
 
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>

<!

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>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<div>

<table style="width: 50%" align="center">

<tr>

<td>

</td>

<td>

</td>

<td>

</td>

</tr>

<tr>

<td align="right">

<asp:Label ID="Label2" runat="server" Text="User Id:"></asp:Label></td>

<td>

<asp:TextBox ID="txtusrid" runat="server" Width="144px"></asp:TextBox>

</td>

<td>

</td>

</tr>

<tr>

<td align="right">

<asp:Label ID="Label3" runat="server" Text="Password:"></asp:Label></td>

<td>

<asp:TextBox ID="txtpass" runat="server" TextMode="Password"></asp:TextBox></td>

<td>

</td>

</tr>

<tr>

<td align="right" style="height: 40px">

<asp:Label ID="Label1" runat="server" Text="Messages:"></asp:Label></td>

<td style="height: 40px">

<asp:TextBox ID="txtmessage" runat="server" TextMode="MultiLine" Width="259px" Height="99px"></asp:TextBox>

</td>

<td style="height: 40px">

</td>

</tr>

<tr>

<td style="height: 21px">

</td>

<td style="height: 21px">

<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />

<asp:Label ID="Label4" runat="server" Width="126px"></asp:Label></td>

<td style="height: 21px">

</td>

</tr>

</table>

</div>

</form>

</

body>
</
html>
 
Code behind

using

System;

using

System.Net;

using

System.Web;

using

System.IO;

public

partial class Default5 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

public void SubmitUserMsg(string username, string passwd, string txttweet)

{

string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + passwd));

byte[] bytes = System.Text.Encoding.ASCII.GetBytes("status=" + txttweet);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/update.xml");

request.Method =

"POST";

request.ServicePoint.Expect100Continue = false;

request.Headers.Add(

"Authorization", "Basic " + user);

request.ContentType =

"application/x-www-form-urlencoded";

request.ContentLength = bytes.Length;

Stream reqStream = request.GetRequestStream();

reqStream.Write(bytes, 0, bytes.Length);

reqStream.Close();

Label4.Text =

"Message Posted";

}

protected void Button1_Click(object sender, EventArgs e)

{

SubmitUserMsg(txtusrid.Text, txtpass.Text, txtmessage.Text);

}

}