javaanfänger Geschrieben 1. Februar 2005 Geschrieben 1. Februar 2005 Hallo Zusammen, kann mir bitte jemand helfen, wie ich den HttpRequest(ASP) auslesen kann? Ich benötige nämlich die IP-Adresse des Absenders, RequestTyp und die RequestMethod. <% Class myDateTime Public myDate Public myFormat 'Public myDayNames 'Public myMonthNames Public Default Function getDateTime() If isDate(myDate) Then Dim y Dim Ergebniss Ergebniss = "" Do While len(myFormat) > 0 select case left(myFormat, 1) case "d" y = 0 Do While left(myFormat, 1) = "d" myFormat = right(myFormat, len(myFormat) - 1) y = y + 1 Loop Select Case y Case 1 Ergebniss = Ergebniss & day(myDate) Case 2 if len(day(myDate)) = 1 then Ergebniss = Ergebniss & "0" end if Ergebniss = Ergebniss & day(myDate) Case 3 Ergebniss = Ergebniss & left(myDayNames(weekday(myDate)-1), 3) Case 4 Ergebniss = Ergebniss & myDayNames(weekday(myDate)-1) end select if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if case "m" y = 0 Do While left(myFormat, 1) = "m" myFormat = right(myFormat, len(myFormat) - 1) y = y + 1 Loop Select Case y Case 1 Ergebniss = Ergebniss & month(myDate) Case 2 if len(month(myDate)) = 1 then Ergebniss = Ergebniss & "0" end if Ergebniss = Ergebniss & month(myDate) Case 3 Ergebniss = Ergebniss & left(myMonthNames(month(myDate) - 1), 3) Case 4 Ergebniss = Ergebniss & myMonthNames(month(myDate) - 1) end select if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if case "y" y = 0 Do While left(myFormat, 1) = "y" myFormat = right(myFormat, len(myFormat) - 1) y = y + 1 Loop Select Case y Case 2 Ergebniss = Ergebniss & right(year(myDate), 2) Case 4 Ergebniss = Ergebniss & year(myDate) end select if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if case "h" y = 0 Do While left(myFormat, 1) = "h" myFormat = right(myFormat, len(myFormat) - 1) y = y + 1 Loop Select Case y Case 1 Ergebniss = Ergebniss & hour(myDate) Case 2 if len(hour(myDate)) = 1 then Ergebniss = Ergebniss & "0" end if Ergebniss = Ergebniss & hour(myDate) end select if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if case "n" y = 0 Do While left(myFormat, 1) = "n" myFormat = right(myFormat, len(myFormat) - 1) y = y + 1 Loop Select Case y Case 1 Ergebniss = Ergebniss & minute(myDate) Case 2 if len(minute(myDate)) = 1 then Ergebniss = Ergebniss & "0" end if Ergebniss = Ergebniss & minute(myDate) end select if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if case "s" y = 0 Do While left(myFormat, 1) = "s" myFormat = right(myFormat, len(myFormat) - 1) y = y + 1 Loop Select Case y Case 1 Ergebniss = Ergebniss & second(myDate) Case 2 if len(second(myDate)) = 1 then Ergebniss = Ergebniss & "0" end if Ergebniss = Ergebniss & second(myDate) end select if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if case else if len(myFormat) > 0 then do while left(myFormat, 1) <> "d" and left(myFormat, 1) <> "m" and left(myFormat, 1) <> "y" and left(myFormat, 1) <> "h" and left(myFormat, 1) <> "n" and left(myFormat, 1) <> "s" and len(myFormat) > 0 if left(myFormat, 1) = " " then Ergebniss = Ergebniss & left(replace(myFormat, " ", " "), 6) else Ergebniss = Ergebniss & left(myFormat, 1) end if myFormat = right(myFormat, len(myFormat) - 1) loop end if end select loop else Ergebniss = Ergebniss & "Kein gültiges Datum!!!" end if getDateTime = Ergebniss End Function End Class ' Deklarieren der Variablen Dim EntityBody Dim Stream Dim OutDirectory Dim Dateiname Dim PartnerId Dim DocumentType Dim Datum ' Auslesen des aktuellen Timestamp Set Datum = New myDateTime 'Datum.myDayNames = Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag") 'Datum.myMonthNames = Array("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember") Datum.myDate = now Datum.myFormat = "yyyy-mm-dd_hhnnss" ' Auslesen der Uebergabeparameter(PartnerId, DocumentType und ) PartnerId = Request.QueryString("PartnerId") DocumentType = Request.QueryString("DocumentType") 'Hier wird das Verzeichnis angegeben, in das die Datei abgelegt werden soll. 'Auf dem Verzeichnis muss aber ASP Schreibrechte haben. OutDirectory = "C:\Test_Curl\From\" 'Hier wird der Zieldateiname angegeben, der Dateiname setzt sich immer 'aus dem DocumentType+Datum+Uhrzeit zusammen Dateiname = PartnerId&DocumentType&Datum.getDateTime()&".xml" 'Option Explicit Response.Buffer = True EntityBody = Request.BinaryRead (Request.TotalBytes) Set Stream = Server.CreateObject("AdoDB.Stream") Stream.Type = 1 stream.Open Stream.Write EntityBody Stream.Position = 0 Stream.SaveToFile OutDirectory & Dateiname Response.Status = "202 Accepted" Response.End %>
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren
Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde Dich hier an.
Jetzt anmelden