Thumb Bild mit ASP.net erzeugen

Mit ASP.net ist es relativ einfach ein Thumb Bild zu erzeugen. ASP.net stellt dafür die Klasse „Graphics“ zur Verfügung.

Dim thumb As New Bitmap(width, height)
 Dim g As Graphics = Graphics.FromImage(thumb)

g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic

g.DrawImage(bm, New Rectangle(destX, destY, width, height), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)

g.Dispose()

thumb.Save(strDestinationpfad, System.Drawing.Imaging.ImageFormat.Jpeg)

Download Beispielscript

imageresize.aspx

E-Mail mit Authentifizierung mit ASP CDO versenden

Beispielscript für das versenden von E-Mails mittels ASP.

<%

Const cdoSendUsingPickup = 1 'E-Mail mithilfe des SMTP Pickup Verzeichnis versenden .
Const cdoSendUsingPort = 2 'E-Mail mithilfe des Netwerkes versenden. (SMTP over the network).

Const cdoAnonymous = 0 'keine Authentifizierung
Const cdoBasic = 1 'Klartext Authentifizierung
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Example CDO Message" 
objMessage.From = """DeinNmae"" <ww@yy.com>" 
objMessage.To = "dietmar@harb.at" 
objMessage.TextBody = "Beispieltext" & vbCRLF & "SMTP Authentifizierung."

'== Nachfolgende Sektion dient zum Konfigurieren des Remote SMTP Servers.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "domainname"

'Authentifizierungsmethode, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'UserID des SMTP Servers, meist die E-Mailadresse
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "ww@yy"

'Passwort des SMTP Servers
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "+++++"

'Server Port (normalerweise 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 

'SSL verwenden? (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

'Connection Timeout in Sekunden 
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End Konfiguration SMTP Server==

objMessage.Send

%>

aspSmartUpload.dll

aspSmartUpload ist eine Komponente zum Uploaden von Files via Classic ASP und IIS.

  1. Installation unter C:\Windows\SysWOW64\
  2. Registrierung  der DLL mit dem Kommando: regsvr32 C:\Windows\SysWOW64\aspSmartUpload.dll
  3. 32-bit Applikation muß für den entsprechenden Applicationpool aktiviert sein.

Beispielcode:


<%
' Variables
' *********
 Dim mySmartUpload
 Dim intCount
 
' Object creation
' ***************
 Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
mySmartUpload.TotalMaxFileSize = 8388608
	mySmartUpload.MaxFileSize = 2097152
	mySmartUpload.AllowedFilesList = "jpg,jpeg,png"
	mySmartUpload.DeniedFilesList = "bat,exe,com,asp"
	mySmartUpload.DenyPhysicalPath = False
' Upload
' ******
 mySmartUpload.Upload

' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
 intCount = mySmartUpload.Save("/aspSmartUpload")
 ' sample with a physical path 
 ' intCount = mySmartUpload.Save("c:\temp\")

' Display the number of files uploaded
' ************************************
 Response.Write(intCount & " file(s) uploaded.")
%>
aspsmartupload_v3_3
aspsmartupload_samples

Client IP Adresse mittels Javascpript auslesen

M=F6chte man auf Browser Seite die IP Adresse des Cl=
ients auslesen kann das wie folgt bewerkstelligt werden.

 

Javascript

<script type=3D"application/javascript">

 
function
getIP(json)
{

    document.write=
("My
public IP address is: "
, json.ip);

 
}

</script>

 

<script type=3D"application/javascript"
src
=3D"https://api.ipify.org?format=3Djsonp&callback=3Dg=
etIP"
></script&=
gt;

 

JQuery

&=
lt;
script type=3D"application/javascript"=
>
 $(func=
tion
() {
    =
$
.getJSON("https://api.ipify.org?form=
at=3Djsonp&callback=3D?"
,=
=

   &=
nbsp;  
function(json) {
   &=
nbsp;    document
.write
(&qu=
ot;My public IP address is: "
, jso=
n
.ip);
   &=
nbsp;  
}
    );
 });
</script>

 

C#

using System=
;
using System=
.Net;=
=

 
namespace Ipify.Examples {
    =
class Program {
   &=
nbsp;    
public static void=
Main
(string[] args) {

   &=
nbsp;        WebClient webClient
=
=3D new WebClient();
   &=
nbsp;        string publicIp
=3D webClient.DownloadString("https://api.ipify.org"
);
   &=
nbsp;        Console
.WriteLine("My public IP Address is: {0}", publicIp);
   &=
nbsp;    
}
    =
}
}=

 

VB.net

Dim client as New System.Net.=
WebClient
Dim ip as String =3D c=
lient
.DownloadString("https://api.i=
pify.org"
)