Solved

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

Posted on 2011-03-10
3
241 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 51

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 51

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Returning a value from a class function to a partial view in MVC5 7 46
SSRS Deployment problem 5 96
Why use this lambda? 12 63
CSS for Popup in ASP.NET 4 17
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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