Showing posts with label ASP. Show all posts
Showing posts with label ASP. Show all posts

Sunday, August 4, 2013

Modifying Your ASP Code to ASPX VB.Net

This could have been a very old topic as ASP (VB) has been phased out long ago and VB.Net is almost obsolete compared with C#. Although VB and VB.net are using the same programming language, the way they work on a web page is vastly different.

Anyway, let's go with the fun of migrating from one programming environment to another.

ASP (VB)

<%
.
.
Dim orange
orange = "apple"
.
.
.
%>

<html>
<body>
.
.
...<%=orange%> . . .
.
.
.
</body>

</html>



ASPX (VB.Net)

<%@ import Namespace="System.IO" %>
<%@ Page Language="vb" Debug="true" %>

<script language="vb" runat="server">

Private orange as String

Sub Page_Load()
.
.
orange = "apple"
.
.
End Sub

</script>

<html>

<body>
.
.
...<% Response.Write(orange) %> . . .
.
.
.
</body>

</html>



It's hard to get used to the new structure of VB.net initially. But once you get it done error-free a few times, you'll get used to it. There are also some syntax changes in VB.net compared to the old VB such as the use of "+" to concatenate strings together instead of using "&".

Anyway, that's all for now and happy coding!!!

Read More »

Monday, March 14, 2011

Make ASP - ADODB using MS Access MDB file to display Chinese text via UTF-8

You need this:


Response.CodePage = 65001



somewhere in your asp code. Tada!

Of course you need this in the HTML header:


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


Complete list of codepage can be found here:

http://msdn.microsoft.com/en-us/library/aa752010(v=vs.85).aspx
Read More »

Monday, December 6, 2010

ASP Sniffer Out IE Sample Codes

user_agent = request.servervariables("HTTP_USER_AGENT")

if InStr(user_agent,"MSIE") > 0 then
position = "absolute"
else
position = "fixed"
end if


These codes above is good to sniff out IE with the rest of the browser in ASP.
Read More »

Sunday, December 5, 2010

How to Print % (percentage sign/symbol) in ASP?

I've tried %%, it doesn't work.

So after googling around still no result.

After that I thought about printing special character using ASP and look up the ASII code table, I came out with this solution:

MyString = "<td width=100" & chr(37) & ">"
.
.
.
print MyString



Walla! Problem solved!
Read More »

Wednesday, January 20, 2010

PHP vs CGI - PERL vs ASP

What a strange round-up comparison.

I like CGI - PERL combination because Linux server is free to set up if I want to build my own web server. PERL is much powerful than ASP after comparing both programming platform. Many tasks can be completed with minimum amount of codes compared to ASP. Anyway, ASP is obsolete and ASP.NET is just as versatile as PERL programming environment.

I like PHP as it is like the combo of PERL and ASP. It has the server side thing as well as the PERL programming flexibility.

As for ASP, I don't see much benefit of using it beside its ability to make use of default.asp similar to index.html to save user from typing the URI. Calling the root directory is sufficient to run the web site. This is briefly explained in my second post on the 2nd of January 2010.

In conclusion, all three are acceptable to be used as your website programming platform. It is up to you to decide. If you are running a Windows server, you seem to have not much choices. If you are using a Apache based web server, you get to choose either PHP or PERL. Actually I like PERL a lot as it is way flexible and versatile but the /cgi-bin/ path showing on the web address is just too risky and it is too inviting to hacker's attack. Hackers instantly know what you are up to. PHP could be the most popular and hassle-free web programming environment. With the support of free database softwate, MySQL, to run database, it is like a gift to web programmers.




Read More »