Solved

how do I use an include file in vb code behind in asp.net

Posted on 2011-03-10
3
242 Views
Last Modified: 2012-05-11
seems simple...all I want to do is have an 'include' file for a set of common code in my vbscript code behinds.
0
Comment
Question by:d2fox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 35097850
include is over :)

use a shared class and put all your shared code here and use them whenever you want...
0
 
LVL 55

Accepted Solution

by:
Huseyin KAHRAMAN earned 500 total points
ID: 35097904
or create a base page and put all your shared code into this base page
then all your web pages will inherit from this base, so they can use the sahred codes...

right now you are inheriting them from

    Inherits System.Web.UI.Page

see sample code
Partial Class myBasePage
    Inherits System.Web.UI.Page

    public function f1()...
    public sub s1()...
End Class

Partial Class Page1
    Inherits myBasePage
...
End Class

Partial Class Page2
    Inherits myBasePage
...
End Class

Open in new window

0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35097964
Was going to comment but then noticed you have already been given the perfect answer.
Shared Classes are the way to go.
If you do decide to go for the basepage option just an addition to Hain Kurt's excellent answer is that your basepage.vb file would go in your web sites app_code folder at the root of the website as putting it in here will mean it gets precompiled.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question