I have added global.asax file in my webservice project. in webservice project i have one class file name as 'Class1.vb' in this class contain some methods() , i want to access those methods from 'class1.vb' in global.asax.vb file. any body knows how to
access those methods in global.asax.vb. file
Ershad.shaik...
Member
13 Points
56 Posts
How to access class in global.asax or how to import namespace in global.asax
May 31, 2010 06:08 AM|LINK
Hi.
I have added global.asax file in my webservice project. in webservice project i have one class file name as 'Class1.vb' in this class contain some methods() , i want to access those methods from 'class1.vb' in global.asax.vb file. any body knows how to access those methods in global.asax.vb. file
Eswaran_MCA
Participant
911 Points
372 Posts
Re: How to access class in global.asax or how to import namespace in global.asax
May 31, 2010 06:59 AM|LINK
hi,
add this line
<%@ Import Namespace="mention_your_namespace_here" %>
thanks
r.e
r. eswaran
Eswaran_MCA
Participant
911 Points
372 Posts
Re: How to access class in global.asax or how to import namespace in global.asax
May 31, 2010 07:00 AM|LINK
hi,
add this line
<%@ Import Namespace="mention_your_namespace_here" %>
if u want to add predefined class such as sqlconnection then u have to import namespace like that..
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><%@ Application Language="C#" %></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><%@ Import Namespace="System.Data" %></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><%@ Import Namespace="System.Data.SqlClient" %></div><%@ Application Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
and
create object for ur class where u have placed.
example
class1 obj = new class1();
obj.show();
thanks
r.e
r. eswaran
nareshguree2...
Star
11118 Points
1997 Posts
Re: How to access class in global.asax or how to import namespace in global.asax
May 31, 2010 07:02 AM|LINK
adeelehsan
All-Star
18319 Points
2746 Posts
Re: How to access class in global.asax or how to import namespace in global.asax
May 31, 2010 07:29 AM|LINK
Hi
If the class is public, you can easily create object of the class and call the method:
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011
pauldaniel
Contributor
2092 Points
342 Posts
Re: How to access class in global.asax or how to import namespace in global.asax
May 31, 2010 10:15 AM|LINK
Hi
Refer this link
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/applications/globalasax.aspx
http://www.dotcominfoway.com/