Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2910 connectés 

  FORUM HardWare.fr
  Programmation
  ASP

  [ASP] Question générale très simple

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[ASP] Question générale très simple

n°310323
bibidec
Posté le 15-02-2003 à 14:20:37  profilanswer
 

je m'intéresse à ASP depuis peu mais avant de me lancer dedans j'aimerais être sur de bien comprendre :
 
c'est quoi le code ASP.net (et ASP normal) ?c du vbscript ou c du code spécifique ASP ?
 
voici comment je vois la chose et dites moi si je débloque ou si c juste :
 
je pense donc moi que le code qui est produit lorsqu'on programme avec ASP.NET est du vbscript.
pour qu'une application ASP fonctionne il faut qu'elle soit mise sur un serveur. ASP étant un produit de MS, il faut que le serveur utilise IIS sinon c'est mort.
si le serveur a IIS (et ASP), lorsqu'une personne télécharge une page asp que l'on a créée (.aspx l'extension ?), le serveur traduit le code vbscript de notre application qui est sur le serveur et le renvoit sous forme de bloque html et balises vbscript interprétable par le navigateur qui affiche les infos au user.
 
Je suis à coté de la plaque ? expliquez moi ça serait génial !
merci d'avance
 
Meilleurs progs
a+

mood
Publicité
Posté le 15-02-2003 à 14:20:37  profilanswer
 

n°331720
Rem'
Posté le 12-03-2003 à 23:59:18  profilanswer
 

En fait une page ASP contient un mélange de script et de HTML.  
Quand tu appelle une page ASP, "le serveur" va interpréter les instructions du script pour générer du code HTML, seul code compréhensible par un navigateur (on peut aussi générer ainsi du Javascript si on veut) qui va alors afficher le résultat.  
La différence entre ASP et ASP.NET c'est qu'en .NET, on sépare dans 2 fichiers distincts code et HTML. De plus, .NET permet le dvt objet, mais là ça se complique un peu...
 [:rem']


---------------
@ + : Rem'
n°331761
MagicBuzz
Posté le 13-03-2003 à 00:15:15  profilanswer
 

on peut écrire l'ASP en JavaScript aussi, mais c'est pas supporté par le SAV de M$

n°331793
urd-sama
waste of space
Posté le 13-03-2003 à 06:56:49  profilanswer
 

Rem' a écrit :

De plus, .NET permet le dvt objet, mais là ça se complique un peu...
 [:rem']  


continue tu m'intéresse  :)


---------------
.: Clône de Drasche .:. Ebichuleys .:. Avec l'Aloe Vera je fais de beaux cacas [:dawa] .: www.oserselancer.com :.
n°333923
Rem'
Posté le 15-03-2003 à 00:41:14  profilanswer
 

Comme je te l'ai dit tu peux développer objet en .Net mais autant trouver un bon tutorial, parce que la leçon serait longue. Grosso modo, chaquye éléement de ton formulaire est un objet identifié par un ID unique. Aussi tu peux accéder à chacun de ces éléments grâce à son ID, sans mélanger script et HTML...
[:rem']


---------------
@ + : Rem'
n°334046
MagicBuzz
Posté le 15-03-2003 à 14:04:43  profilanswer
 

Juste pour info, contrairement à ce que beaucoup de ges croient, VB et donc l'ASP tout cours, supporte les objets. C'est évidement pas aussi poussé que Java par exemple, mais cela permet de faire des choses pas mal déjà.
 
Exemple d'un objet programmé en ASP
 

Code :
  1. <%
  2. ' ------------------------------------------------------------------------------
  3. ' Container of Field Properties
  4. Class clsField
  5. Public FileName
  6. Public ContentType
  7. Public Value
  8. Public FieldName
  9. Public Length
  10. Public BinaryData
  11. End Class
  12. ' ------------------------------------------------------------------------------
  13. Class clsUpload
  14. ' ------------------------------------------------------------------------------
  15. Private nFieldCount
  16. Private oFields()
  17. ' ------------------------------------------------------------------------------
  18. Public Property Get Count()
  19.  Count = nFieldCount
  20. End Property
  21. ' ------------------------------------------------------------------------------
  22. Public Default Property Get Field(ByRef asFieldName)
  23.  Dim lnLength
  24.  Dim lnIndex
  25.  lnLength = UBound(oFields)
  26.  If IsNumeric(asFieldName) Then
  27.   If lnLength >= asFieldName And asFieldName > -1 Then
  28.    Set Field = oFields(asFieldName)
  29.   Else
  30.    Set Field = New clsField
  31.   End If
  32.  Else
  33.   For lnIndex = 0 To lnLength
  34.    If LCase(oFields(lnIndex).FieldName) = LCase(asFieldName) Then
  35.     Set Field = oFields(lnIndex)
  36.     Exit Property
  37.    End If
  38.   Next
  39.   Set Field = New clsField
  40.  End If
  41. End Property
  42. ' ------------------------------------------------------------------------------
  43. Public Function Exists(ByRef avKeyIndex)
  44.  Exists = Not IndexOf(avKeyIndex) = -1
  45. End Function
  46. ' ------------------------------------------------------------------------------
  47. Public Property Get ValueOf(ByRef avKeyIndex)
  48.  Dim lnIndex
  49.  lnIndex = IndexOf(avKeyIndex)
  50.  if lnIndex = -1 Then Exit Property
  51.  ValueOf = oFields(lnIndex).Value
  52. End Property
  53. ' ------------------------------------------------------------------------------
  54. Public Property Get FileNameOf(ByRef avKeyIndex)
  55.  Dim lnIndex
  56.  lnIndex = IndexOf(avKeyIndex)
  57.  if lnIndex = -1 Then Exit Property
  58.  FileNameOf = oFields(lnIndex).FileName
  59. End Property
  60. ' ------------------------------------------------------------------------------
  61. Public Property Get LengthOf(ByRef avKeyIndex)
  62.  Dim lnIndex
  63.  lnIndex = IndexOf(avKeyIndex)
  64.  if lnIndex = -1 Then Exit Property
  65.  LengthOf = oFields(lnIndex).LengthOf
  66. End Property
  67. ' ------------------------------------------------------------------------------
  68. Public Property Get BinaryDataOf(ByRef avKeyIndex)
  69.  Dim lnIndex
  70.  lnIndex = IndexOf(avKeyIndex)
  71.  if lnIndex = -1 Then Exit Property
  72.  BinaryDataOf = oFields(lnIndex).BinaryData
  73. End Property
  74. ' ------------------------------------------------------------------------------
  75. Private Function IndexOf(ByVal avKeyIndex)
  76.  Dim lnIndex
  77.  If IsNumeric(asFieldName) Then
  78.   avKeyIndex = CLng(avKeyIndex)
  79.   If nFieldCount > avKeyIndex And avKeyIndex > -1 Then
  80.    IndexOf = avKeyIndex
  81.   Else
  82.    IndexOf = -1
  83.   End If
  84.  Else
  85.   For lnIndex = 0 To nFieldCount - 1
  86.    If LCase(oFields(lnIndex).FieldName) = LCase(avKeyIndex) Then
  87.     IndexOf = lnIndex
  88.     Exit Function
  89.    End If
  90.   Next
  91.   IndexOf = -1
  92.  End If
  93. End Function
  94. ' ------------------------------------------------------------------------------
  95. Public Property Get ContentTypeOf(ByRef avKeyIndex)
  96.  Dim lnIndex
  97.  lnIndex = IndexOf(avKeyIndex)
  98.  if lnIndex = -1 Then Exit Property
  99.  ContentTypeOf = oFields(lnIndex).ContentType
  100. End Property
  101. ' ------------------------------------------------------------------------------
  102. Private Sub Class_Terminate()
  103.  For lnIndex = 0 To nFieldCount - 1
  104.   Set oFields(0) = Nothing
  105.  Next
  106. End Sub
  107. ' ------------------------------------------------------------------------------
  108. Private Sub Class_Initialize()
  109.  Dim lnBytes    ' Bytes received from the client
  110.  Dim lnByteCount   ' Number of bytes received
  111.  Dim lnStartPosition  ' Position at which content begins
  112.  Dim lnEndPosition  ' Position at which content ends
  113.  Dim loDic    ' Contains properties of each
  114.        ' specific field
  115.        ' Local dictionary object(s)
  116.        ' to be appended to class-scope
  117.        ' dictioary object.
  118.  Dim lnBoundaryBytes  ' Bytes contained within the current boundary
  119.  Dim lnBoundaryStart  ' Position at wich the current boundary begins
  120.        ' within the lnBytes binary data.
  121.  Dim lnBoundaryEnd  ' Position at wich the current boundary ends
  122.        ' within the lnBytes binary data.
  123.  Dim lnDispositionPosition
  124.  Dim lsFieldName   ' Name of the current field being parsed from
  125.        ' Binary Data
  126.  Dim lsFileName   ' Name of the file within the current boundary
  127.  Dim lnFileNamePosition ' Location of file name within current boundary
  128.  ' Initialize Fields
  129.  nFieldCount = 0
  130.  ReDim oFields(-1)
  131.  ' Read the bytes (binary data) into memory
  132.  lnByteCount = Request.TotalBytes
  133.  lnBytes = Request.BinaryRead(lnByteCount)
  134.  'Get the lnBoundaryBytes
  135.  lnStartPosition = 1
  136.  lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB(vbCr))
  137.  lnBoundaryBytes = MidB(lnBytes, lnStartPosition, lnEndPosition - lnStartPosition)
  138.  lnBoundaryStart = InstrB(1, lnBytes, lnBoundaryBytes)
  139.  ' Loop until the BoundaryBytes begin with "--"
  140.  Do Until (lnBoundaryStart = InstrB(lnBytes, lnBoundaryBytes & CStrB("--" )))
  141.   ' All data within this boundary is stored within a local dictionary
  142.   ' to be appended to the class-scope dictionary.
  143.   ReDim Preserve oFields(nFieldCount)
  144.   nFieldCount = nFieldCount + 1
  145.   Set loField = New clsField
  146.   lnDispositionPosition = InstrB(lnBoundaryStart, lnBytes, CStrB("Content-Disposition" ))
  147.   ' Get an object name
  148.   lnStartPosition = InstrB(lnDispositionPosition, lnBytes, CStrB("name=" )) + 6
  149.   lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB("""" ))
  150.   lsFieldName = CStrU(MidB(lnBytes, lnStartPosition, lnEndPosition - lnStartPosition))
  151.   loField.FieldName = lsFieldName
  152.   ' Get the location fo the file name.
  153.   lnFileNamePosition = InstrB(lnBoundaryStart, lnBytes, CStrB("filename=" ))
  154.   lnBoundaryEnd = InstrB(lnEndPosition, lnBytes, lnBoundaryBytes)
  155.   'Test if object is a file
  156.   If Not lnFileNamePosition = 0 And lnFileNamePosition < lnBoundaryEnd Then
  157.    ' Parse Filename
  158.    lnStartPosition = lnFileNamePosition + 10
  159.    lnEndPosition =  InstrB(lnStartPosition, lnBytes, CStrB("""" ))
  160.    lsFileName = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition))
  161.    loField.FileName = lsFileName
  162.    ' Parse Content-Type
  163.    lnStartPosition = InstrB(lnEndPosition,lnBytes,CStrB("Content-Type:" )) + 14
  164.    lnEndPosition = InstrB(lnStartPosition,lnBytes,CStrB(vbCr))
  165.    ContentType = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition))
  166.    loField.ContentType = ContentType
  167.    ' Parse Content
  168.    lnStartPosition = lnEndPosition + 4
  169.    lnEndPosition = InstrB(lnStartPosition,lnBytes,lnBoundaryBytes)-2
  170.    Value = MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition)
  171.    loField.BinaryData = Value & CStrB(vbNull)
  172.    loField.Length = LenB(Value)
  173.   Else
  174.    ' Parse Content
  175.    lnStartPosition = InstrB(lnDispositionPosition, lnBytes, CStrB(vbCr)) + 4
  176.    lnEndPosition = InstrB(lnStartPosition, lnBytes, lnBoundaryBytes) - 2
  177.    Value = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition))
  178.    loField.Value = Value
  179.    loField.Length = Len(Value)
  180.   End If
  181.   Set oFields(UBound(oFields)) = loField
  182.   'Loop to next object
  183.   lnBoundaryStart = InstrB(lnBoundaryStart + LenB(lnBoundaryBytes), lnBytes, lnBoundaryBytes)
  184.   Set loField = Nothing
  185.  Loop
  186. End Sub
  187. ' ------------------------------------------------------------------------------
  188. Private Function CStrU(ByRef psByteString)
  189.  Dim lnLength
  190.  Dim lnPosition
  191.  lnLength = LenB(psByteString)
  192.  For lnPosition = 1 To lnLength
  193.   CStrU = CStrU & Chr(AscB(MidB(psByteString, lnPosition, 1)))
  194.  Next
  195. End Function
  196. ' ------------------------------------------------------------------------------
  197. Private Function CStrB(ByRef psUnicodeString)
  198.  Dim lnLength
  199.  Dim lnPosition
  200.  lnLength = Len(psUnicodeString)
  201.  For lnPosition = 1 To lnLength
  202.   CStrB = CStrB & ChrB(AscB(Mid(psUnicodeString, lnPosition, 1)))
  203.  Next
  204. End Function
  205. ' ------------------------------------------------------------------------------
  206. End Class
  207. ' ------------------------------------------------------------------------------
  208. %>


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  ASP

  [ASP] Question générale très simple

 

Sujets relatifs
[ASP]Javascrypt ou VBscrypt ????(pour debuter)Erreur de compil en C, qqun peut m'aider ? (pb ultra simple)
PHP/Apache et ASP/IIS : conflit ?Tomcat : question de newbie
Fonction COPY, erreur persistante et très gênante....ASP Erreur500 sous IIS4
une petite question javascript[ASP] récupérer une adresse mail depuis le carnet d'adresses outlook
Question Newbi --- pourquoi utilise t on argc ou argv[PHP] très débutant : include qui fonctionne pas ? [Updated]
Plus de sujets relatifs à : [ASP] Question générale très simple


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR