Posts Tagged ‘.NET 2.0’

FTP file upload in .NET 2.0

Friday, April 17th, 2009

It is clear that the FileUpload components, which can be found on the Standard toolbar of Visual Studio 2005 allows uploading files to the remote site, but does not cover all the expectations desired or at least not mine.
So it is interesting to know how we can attack a specific server and an FTP to copy the desired file to the remote location to stay.

To do this:

Step 1: In general declarations establish that the class will use.

C#

using System.Net;

VB.NET

Imports System.Net

Step 2: Create a button in the Click event and write the following code in C# or VB.NET:

C#

private static void wc_UploadFTP(string ftpServerPath, string filename, string username, string password)
 {
WebClient ClientFtp = new WebClient() ;
ClientFtp.Credentials = new NetworkCredential(username, password);
ClientFtp.UploadFile(ftpServerPath + "/" + new FileInfo(filename).Name, "STOR", filename);
}

VB.NET


Private Shared Sub wc_UploadFTP(ByVal ftpServerPath As String, ByVal filename As String, ByVal username As String, ByVal password As String)
 Dim ClientFtp As New WebClient()
 ClientFtp.Credentials = New NetworkCredential(username, password)
 ClientFtp.UploadFile((ftpServerPath & "/") + New FileInfo(filename).Name, "STOR", filename)
End Sub

Happy Programming!!

Security Audit Events in ASP.NET 2.0

Tuesday, February 17th, 2009
Event Description
WebAuditEvent Base class for all audit events.
WebFailureAuditEvent Base class for all failure audit events, which are raised whenever a security action fails. ASP.NET 2.0 raises these events when URL or file authorization fails to authorize the request.
WebSuccessAuditEvent Base class for all success audit events, which are raised whenever a security action succeeds. ASP.NET 2.0 raises these events when URL or file authorization succeeds in authorizing the request.
WebAuthenticationFailureAuditEvent Base class for authentication failure audit events, which are raised whenever an authentication attempt fails. ASP.NET 2.0 raises these events when Membership providers or forms authentication fail to validate provided credentials, or when the forms authentication ticket fails to be decrypted or validated.
WebAuthenticationSuccessAuditEvent Base class for authentication success audit events, which are raised whenever an authentication attempt succeeds. ASP.NET 2.0 raises these events when Membership providers or forms authentication succeed in validating provided credentials.
WebViewStateFailureAuditEvent The class for the ViewState failure audit event, which is raised whenever ASP.NET fails to process the ViewState due to an encryption or validation problem.

Source : Click Here…