Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Public functions in ASP .NET

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

I am new to asp .net, I have some VB functions that I need to make public to all webpages in my application. My webhost does not allow me to upload .dlls, im not sure if this is an issue.

I have read many forum posts but none seem to answer my question.

Here are some basic example functions that i wish to use:

Public Function getdatetime()
Return FormatDateTime(DateTime.Now, DateFormat.ShortDate)
End Function

Public Function Get_SecurePath()
Return ""
End Function

Public Function GetQuickLinks()
Return ""
End Function

I wish to execute them directly from the webpage (if possible):

<% response.write(getquicklinks()) %>

Thanks B
 
Hi B

"My webhost does not allow me to upload .dlls"

I would reccomend you get a new host! The real advantage of .NET is compiling your VB code into dll and seperating this from your presentation HTML. To use .NET in the style of classic ASP is to some extent missing the point.

You could achieve the above very simply with compiled dll by using the Global.asax.vb file. Any Public method in that file would be available throughout your application by using

Global.Method()

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Thanks Rob

How can declare the Global.asax file once so that it can be used throughout the page?

Thanks Bernie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top