|M| 在页面中aspx里面写程序的时候怎么写上方法啊
Public Shared Function GetMD5(ByVal EnData As String) As String
...
End Function
如上面是转MD5的
现在我在aspx里面写
<%
Public Shared Function GetMD5(ByVal EnData As String) As String
...
End Function
Dim UnData=GetMd5( "123 ");
%>
上面这个要怎么改才能运行
[解决办法]
<%@ Page Language= "VB " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<script runat= "server ">
Public Shared Function GetMD5(ByVal EnData As String) As String
...
End Function
</script>
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> Untitled Page </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:Button ID= "Button1 " runat= "server " OnClick= "Button1_Click " Text= "Button " /> </div>
</form>
</body>
</html>
[解决办法]
<%@ Page Language= "VB " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<script runat= "server ">
Public Shared Function GetMD5(ByVal EnData As String) As String
GetMD5 = "abc "
End Function
Dim UnData = GetMD5( "123 ")
</script>
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
</div>
</form>
</body>
</html>
[解决办法]
<script runat= "server "> Public Shared Function GetMD5(ByVal EnData As String) As StringGetMD5 = "abc "End FunctionDim UnData = GetMD5( "123 ")Sub Page_Load()Response.Write(UnData) End Sub </script>