aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



{#advanced_dlg.about_title}
by Aamir Hasan   on Wednesday, February 22, 2012
In this example you will see who to delete record from database which match the id in the patient table. More
Tags:
{#advanced_dlg.about_title}
by Aamir Hasan   on Friday, February 10, 2012
Design Pattern More
{#advanced_dlg.about_title}
by Aamir Hasan   on Tuesday, June 14, 2011
In this example, you will see how to get current windows username in asp.net. More
{#advanced_dlg.about_title}
by Aamir Hasan   on Tuesday, February 22, 2011
This article describes how to secure your password before going to save in database or XML file etc More
{#advanced_dlg.about_title}
by Aamir Hasan   on Friday, November 5, 2010
In this example, i have told you how to download file from FTP using C#/VB.NET.Let's start Namespaces required: C# using System.Net;using System.IO; VB.NET Imports System.NetImports System.IO Following is the code of download file from the FTP Server. C# private void Download(string filePath, string fileName)    {        FTPSettings.IP = "DOMAIN NAME";        FTPSettings.UserID = "USER ID";        FTPSettings.Password = "PASSWORD";        FtpWebRequest reqFTP = null;        Stream ftpStream = null;        try        {            FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);            reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + FTPSettings.IP + "/" + fileName));            reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;            reqFTP.UseBinary = true;            reqFTP.Credentials = new NetworkCredential(FTPSettings.UserID, FTPSettings.Password);            FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();            ftpStream = response.GetResponseStream();            long cl = response.ContentLength;            int bufferSize = 2048;            int readCount;            byte[] buffer = new byte[bufferSize];            readCount = ftpStream.Read(buffer, 0, bufferSize);            while (readCount > 0)            {                outputStream.Write(buffer, 0, readCount);                readCount = ftpStream.Read(buffer, 0, bufferSize);            }            ftpStream.Close();            outputStream.Close();            response.Close();        }        catch (Exception ex)        {            if (ftpStream != null)            {                ftpStream.Close();                ftpStream.Dispose();            }            throw new Exception(ex.Message.ToString());        }    }    public static class FTPSettings    {        public static string IP { get; set; }        public static string UserID { get; set; }        public static string Password { get; set; }    } VB.NET    Private Sub Download(ByVal filePath As String, ByVal fileName As String)        FTPSettings.IP = "DOMAIN NAME"        FTPSettings.UserID = "USER ID"        FTPSettings.Password = "PASSWORD"        Dim reqFTP As FtpWebRequest = Nothing        Dim ftpStream As Stream = Nothing        Try            Dim outputStream As New FileStream(filePath + "\" + fileName, FileMode.Create)            reqFTP = DirectCast(FtpWebRequest.Create(New Uri("ftp://" + FTPSettings.IP + "/" + fileName)), FtpWebRequest)            reqFTP.Method = WebRequestMethods.Ftp.DownloadFile            reqFTP.UseBinary = True            reqFTP.Credentials = New NetworkCredential(FTPSettings.UserID, FTPSettings.Password)            Dim response As FtpWebResponse = DirectCast(reqFTP.GetResponse(), FtpWebResponse)            ftpStream = response.GetResponseStream()            Dim cl As Long = response.ContentLength            Dim bufferSize As Integer = 2048            Dim readCount As Integer            Dim buffer As Byte() = New Byte(bufferSize - 1) {}            readCount = ftpStream.Read(buffer, 0, bufferSize)            While readCount > 0                outputStream.Write(buffer, 0, readCount)                readCount = ftpStream.Read(buffer, 0, bufferSize)            End While            ftpStream.Close()            outputStream.Close()            response.Close()        Catch ex As Exception            If ftpStream IsNot Nothing Then                ftpStream.Close()                ftpStream.Dispose()            End If            Throw New Exception(ex.Message.ToString())        End Try    End Sub    Public NotInheritable Class FTPSettings        Private Sub New()        End Sub        Public Shared Property IP() As String            Get                Return m_IP            End Get            Set(ByVal value As String)                m_IP = Value            End Set        End Property        Private Shared m_IP As String        Public Shared Property UserID() As String            Get                Return m_UserID            End Get            Set(ByVal value As String)                m_UserID = Value            End Set        End Property        Private Shared m_UserID As String        Public Shared Property Password() As String            Get                Return m_Password            End Get            Set(ByVal value As String)                m_Password = Value            End Set        End Property        Private Shared m_Password As String    End Class Download DownloadFile.zip (1.24 kb) You can use Download function in both asp.net and Windows Form csharp/VB.Net Application.
{#advanced_dlg.about_title}
by Aamir Hasan   on Thursday, November 4, 2010
In this example, i have told you how to Rename file name on FTP server. FTP (File Transfer protocol) is used to transfer a file on another server. To Rename File name on FTP server you must have IP Address, username and password to connect to FTP server.Let's start. Namespace required to work FtpWebRequest and Stream Class. C#using System.Net;using System.IO;VB.NETImports System.NetImports System.IO Rename Filename on FTP Server function C#    private void RenameFileName(string currentFilename, string newFilename)    {        FTPSettings.IP = "DOMAIN NAME";        FTPSettings.UserID = "USER ID";        FTPSettings.Password = "PASSWORD";        FtpWebRequest reqFTP = null;        Stream ftpStream = null ;        try        {            reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + FTPSettings.IP + "/" + currentFilename));            reqFTP.Method = WebRequestMethods.Ftp.Rename;            reqFTP.RenameTo = newFilename;            reqFTP.UseBinary = true;            reqFTP.Credentials = new NetworkCredential(FTPSettings.UserID, FTPSettings.Password);            FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();            ftpStream = response.GetResponseStream();            ftpStream.Close();            response.Close();        }        catch (Exception ex)        {            if (ftpStream != null)            {                ftpStream.Close();                ftpStream.Dispose();            }            throw new Exception(ex.Message.ToString());        }    }    public static class FTPSettings    {        public static string IP { get; set; }        public static string UserID { get; set; }        public static string Password { get; set; }    } VB.NET    Private Sub RenameFileName(ByVal currentFilename As String, ByVal newFilename As String)        FTPSettings.IP = "DOMAIN NAME"        FTPSettings.UserID = "USER ID"        FTPSettings.Password = "PASSWORD"        Dim reqFTP As FtpWebRequest = Nothing        Dim ftpStream As Stream = Nothing        Try            reqFTP = DirectCast(FtpWebRequest.Create(New Uri("ftp://" + FTPSettings.IP + "/" + currentFilename)), FtpWebRequest)            reqFTP.Method = WebRequestMethods.Ftp.Rename            reqFTP.RenameTo = newFilename            reqFTP.UseBinary = True            reqFTP.Credentials = New NetworkCredential(FTPSettings.UserID, FTPSettings.Password)            Dim response As FtpWebResponse = DirectCast(reqFTP.GetResponse(), FtpWebResponse)            ftpStream = response.GetResponseStream()            ftpStream.Close()            response.Close()        Catch ex As Exception            If ftpStream IsNot Nothing Then                ftpStream.Close()                ftpStream.Dispose()            End If            Throw New Exception(ex.Message.ToString())        End Try    End Sub    Public NotInheritable Class FTPSettings        Private Sub New()        End Sub        Public Shared Property IP() As String            Get                Return m_IP            End Get            Set(ByVal value As String)                m_IP = Value            End Set        End Property        Private Shared m_IP As String        Public Shared Property UserID() As String            Get                Return m_UserID            End Get            Set(ByVal value As String)                m_UserID = Value            End Set        End Property        Private Shared m_UserID As String        Public Shared Property Password() As String            Get                Return m_Password            End Get            Set(ByVal value As String)                m_Password = Value            End Set        End Property        Private Shared m_Password As String    End Class   Function to used as C# RenameFileName("file1.txt","file2.text"); VB.NET RenameFileName("file1.txt","file2.text") You can use this function on both website and desktop Application Download FTP Rename FileName.zip.zip (1.10 kb)
Tags:
{#advanced_dlg.about_title}
by Aamir Hasan   on Wednesday, November 3, 2010
In this example, I have demonstrate, how to Split a string using Linq query... More
{#advanced_dlg.about_title}
by Aamir Hasan   on Wednesday, November 3, 2010
In this example, I have demonstrate, how to match a string from a string Array... More
Tags:
{#advanced_dlg.about_title}
by Aamir Hasan   on Wednesday, November 3, 2010
I have told you how to make .Net Application compatible with 32bit and 64bit window platform... More
Tags:
{#advanced_dlg.about_title}
by Aamir Hasan   on Sunday, September 12, 2010
FlowChart is new type in WorkFlow. it is used to eaily mantains Large Applications.Old version of Workflow , the WorkflowRuntime was restricted to one WorkflowRuntime. Now WorkFlowInstance has been replaced with the class WorkflowInstance.Now you can easily attached Event Handler and delegate to each workflow becasue of Class WorkflowInstance. Open your Visual Studio 2010. Create new workflow console application from visual studio Menu New->Project. From Solution Explorer double click on Workflow1.xaml file. Drag and drop a Flowchart activity from Flowchart group onto the desginer surface as shown in Figure 1.1 Figure 1.1 The green circle indicates where the workflow starts. Drag and drop WriteLine activity to surface area from Primitives group as shown in Figure 1.2 Figure 1.2 Take your mouse pointer to green circle, three gray dot will be appear, drag a node to writeline activity and drop it on one gray node. You will see the direction of workflow from circle to writeline as shown in Figure 1.3 Figure.1.3 Goto the properties of Writeline activity and Click the linkbutton of text. Small window will be open write the VB expression as shown in below Figure 1.4 Figure 1.4 Open your Program.cs file and add Console.Write("Press enter to exit."); Console.ReadKey();   Console.ReadKey() will prevent to immedialtely close of window. Press F5 to run it. Figure 1.5 shows the output. Figure 1.5 Download Part 1 - Workflow Console Application Password aamirhasan
Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5