Jun
10
2021
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
source: https://stackoverflow.com/questions/9823010/how-to-force-https-using-a-web-config-file
no comments | posted in ASP, Razno
Mar
17
2020
<rewrite>
<rules>
<rule name="redirect" enabled="true">
<match url="(.*)" />
<action type="Redirect" url="http://www.example.com/" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
no comments | posted in ASP
Oct
31
2019
<system.webServer>
<httpRedirect enabled="true" destination="http://www.google.com/" />
</system.webServer>
no comments | posted in ASP, Razno
Oct
4
2019
Dim loConn, lsSQL, loRs
Set loConn = CreateObject("ADODB.Connection")
' Open a connection to the database
loConn.Open(application("DSN=myDSN;UID=something;PWD=Something;"))
' Insert a new record into the table
lsSQL = "SET NOCOUNT ON;" &_
"INSERT INTO tbl_test (naziv) VALUES ('pero');" &_
"SELECT @@IDENTITY AS NewID;"
' Execute the SQL statement
Set loRs = loConn.Execute(lsSQL)
' Get the inserted ID
myNewID= loRs.Fields("NewID").value
response.write myNewID
' Close the connection
loConn.Close()
Set loConn = Nothing
The SET NOCOUNT ON suppresses messages like “1 Row(s) affected” being sent back. These messages are sent back every time SQL statement is executed.
source: http://www.kamath.com/tutorials/tut007_identity.asp
no comments | posted in ASP
Sep
25
2019
FUNCTION URLDecode(str)
'// This function:
'// - decodes any utf-8 encoded characters into unicode characters eg. (%C3%A5 = å)
'// - replaces any plus sign separators with a space character
'//
'// IMPORTANT:
'// Your webpage must use the UTF-8 character set. Easiest method is to use this META tag:
'//
'//
Dim objScript
Set objScript = Server.CreateObject("ScriptControl")
objScript.Language = "JavaScript"
URLDecode = objScript.Eval("decodeURIComponent(""" & str & """.replace(/\+/g,"" ""))")
Set objScript = NOTHING
END FUNCTION
source: https://gist.github.com/gwobcke/2773779
no comments | posted in ASP
Sep
9
2019
<%
FUNCTION stripHTML(strHTML)
Dim objRegExp, strOutput, tempStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|n)+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
END FUNCTION
%>
source: https://gist.github.com/gwobcke/1027133
no comments | posted in ASP
Sep
9
2019
<%
Function StripSpecialChar(strInput)
Dim objRegExp
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "[\+\#\@\&\%\$\?\*]"
'//Replace all character matches with an Empty String
StripSpecialChar = objRegExp.Replace(strInput, "")
Set objRegExp = Nothing
End Function
%>
source: https://gist.github.com/gwobcke/1027138/revisions
no comments | posted in ASP
Sep
8
2019
Function InArray(Needle, Haystack)
Dim i, x
InArray = False
For i = 0 To Ubound(Haystack)
If IsArray(Needle) = True Then
For x = 0 To Ubound(Needle)
If Trim(Haystack(i)) = Trim(Needle(x)) Then
InArray = True
Exit Function
End If
Next
Else
If Trim(Haystack(i)) = Trim(Needle) Then
InArray = True
Exit Function
End If
End If
Next
End Function
SOURCE: https://gist.github.com/gwobcke/1044367
no comments | posted in ASP
Sep
8
2019
Option Explicit
dim list
Set list = CreateObject("System.Collections.ArrayList")
list.Add "Banana"
list.Add "Apple"
list.Add "Pear"
'list.Sort
'list.Reverse
response.write list.Count ' --> 3
response.write list.Item(0) ' --> Pear
response.write list.IndexOf("Apple", 0) ' --> 2
response.write join(list.ToArray(), ", ") ' --> Pear, Banana, Apple
source: https://stackoverflow.com/questions/13585660/lists-in-vbscript
no comments | posted in ASP
Sep
14
2016
Problem: imamo varijable slika_1, slika_2, slika_3, slika_4 i slika_5 i želimo ispisati svih 5 slika koristeći for petlju
Rješenje:
for i=1 to 5
execute("slika = slika_" & i)
response.write(slika)
next
no comments | posted in ASP