import class in asp.net inline codeing

inline-code, vb.net

Solution

You are specifiying a class name in your impor sentence, and it expects a namespace. Replace

<%@ Import Namespace="SharedClass" %>

with

<%@ Import Namespace="SharedClassNamespace" %>

Problem

I create a class SharedClass.vb in my project . And i want to import that SharedClass.vb on my aspx page and want to use that class on my aspx file. How can i do that . i Try this but not success ``` <%@ Page Language="vb" AutoEventWireup="false" Inherits="ipmseattle.Web._default5" Explicit="false" %> <%@ Import Namespace = "MySql.Data.MySqlClient" %> <%@ Import Namespace="SharedClass" %> ``` And this is the function that i created ``` Public Class SharedClass Public Shared Function encode(ByVal x) x = x & " " encode = Replace(x, "'", "''") encode = Replace(encode, ";", "") encode = Replace(encode, "--", "") encode = Replace(encode, "({", "") encode = Replace(encode, "/*", "") encode = Trim(encode) End Function End Class ``` i am using inline coding . Where the code part is on my .aspx file . Here i am using that class ``` if request("date") <> "" then if isdate(request("date")) then SQLADDON = "event_start_date >= '" & encode(Request("date")) & "' and event_start_date < '" & encode(formatmysqldate(DateAdd("d", 1, Request("date")))) & "' and event_title like '%Apple%' " else ``` Regards

Original source