473,661 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

custom namespaces

Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use in
creating some utility classes, which I seem to have done OK, however, I'm
having a problem trying to use the class with the error the namespace can't
be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially
using notepad, and trying to get my code behind file to use the class in my
custom namespace.

I'm guessing the problem is that I haven't compiled my namespace into a dll,
but I don't have access to the command line compiler on the network PC here
which doesn't help, nor Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was
using Visual Studio, but I don't have it, nor a command line compiler. Is it
possible without these?

Basically, I'm looking for an article that is entitled "how to create and
reference your own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the bin
directory to no avail.

Any tips greatly appreciated
Cheers
Matt
Nov 19 '05 #1
4 1439
Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/...vs/default.asp

If you look at the code in WebForm2.aspx.v b as your codebehind,
but use the Page statement in WebForm3.aspx, you'll have
the answer to your question.

In essence, to use code-behind, you can :

1. use the Visual Studio model
2. compile the code-behind to an assembly and reference it in the aspx
3. use the Src and Inherits properties :
<%@ Page Language="vb" AutoEventWireup ="false" Src="WebForm2.a spx.vb"
Inherits="WebFo rm2"%>

This last one is your answer. Adapt it to your needs.

You will be able to call any class, property or method by using Src,
just like if you were using an actual assembly.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use in creating some
utility classes, which I seem to have done OK, however, I'm having a problem trying to
use the class with the error the namespace can't be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially using notepad,
and trying to get my code behind file to use the class in my custom namespace.

I'm guessing the problem is that I haven't compiled my namespace into a dll, but I don't
have access to the command line compiler on the network PC here which doesn't help, nor
Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was using Visual
Studio, but I don't have it, nor a command line compiler. Is it possible without these?

Basically, I'm looking for an article that is entitled "how to create and reference your
own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the bin directory to
no avail.

Any tips greatly appreciated
Cheers
Matt

Nov 19 '05 #2
Thanks Juan, but I'm already doing that... - what I need to do is access the
classes in my own custom *namespace* which is essentially in it's own
*standalone* cs (utility) file, and for which I think I must need to compile
it so that the code behind can actually see/find reference to the custom
namespace...
Matt

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:O%******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/...vs/default.asp

If you look at the code in WebForm2.aspx.v b as your codebehind,
but use the Page statement in WebForm3.aspx, you'll have
the answer to your question.

In essence, to use code-behind, you can :

1. use the Visual Studio model
2. compile the code-behind to an assembly and reference it in the aspx
3. use the Src and Inherits properties :
<%@ Page Language="vb" AutoEventWireup ="false" Src="WebForm2.a spx.vb"
Inherits="WebFo rm2"%>

This last one is your answer. Adapt it to your needs.

You will be able to call any class, property or method by using Src,
just like if you were using an actual assembly.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use
in creating some utility classes, which I seem to have done OK, however,
I'm having a problem trying to use the class with the error the namespace
can't be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially
using notepad, and trying to get my code behind file to use the class in
my custom namespace.

I'm guessing the problem is that I haven't compiled my namespace into a
dll, but I don't have access to the command line compiler on the network
PC here which doesn't help, nor Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was
using Visual Studio, but I don't have it, nor a command line compiler. Is
it possible without these?

Basically, I'm looking for an article that is entitled "how to create and
reference your own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the
bin directory to no avail.

Any tips greatly appreciated
Cheers
Matt


Nov 19 '05 #3
re:
I'm having a problem trying to use the class with the error "the namespace can't be
found."
If I understand you right, in that you're already using src,
then method #2 ( assembly compilation ) is what you need to implement.

There's sample compilation commands in that article.

re:
I'm guessing the problem is that I haven't compiled my namespace into a dll, but I
don't have access to the command line compiler


Well, compiled code doesn't work by osmosis.

Either you use the "src=" method, or you compile to an assembly
from the command-line, if you aren't using Visual Studio.

There's no getting around that.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:ee******** ******@TK2MSFTN GP14.phx.gbl... Thanks Juan, but I'm already doing that... - what I need to do is access the classes in
my own custom *namespace* which is essentially in it's own *standalone* cs (utility)
file, and for which I think I must need to compile it so that the code behind can
actually see/find reference to the custom namespace...
Matt

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:O%******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi, Matt.

Take a look at :
http://www.asp101.com/articles/john/...vs/default.asp

If you look at the code in WebForm2.aspx.v b as your codebehind,
but use the Page statement in WebForm3.aspx, you'll have
the answer to your question.

In essence, to use code-behind, you can :

1. use the Visual Studio model
2. compile the code-behind to an assembly and reference it in the aspx
3. use the Src and Inherits properties :
<%@ Page Language="vb" AutoEventWireup ="false" Src="WebForm2.a spx.vb"
Inherits="WebFo rm2"%>

This last one is your answer. Adapt it to your needs.

You will be able to call any class, property or method by using Src,
just like if you were using an actual assembly.
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Matt Jensen" <re************ ***@microsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Howdy
Relatively new to .NET, I'm trying to create custom a namespace for use in creating
some utility classes, which I seem to have done OK, however, I'm having a problem
trying to use the class with the error the namespace can't be found.

I've really got no idea what I'm doing, I'm coding in C# and essentially using
notepad, and trying to get my code behind file to use the class in my custom
namespace.

I'm guessing the problem is that I haven't compiled my namespace into a dll, but I
don't have access to the command line compiler on the network PC here which doesn't
help, nor Visual Studio.

I've been told I somehow need to add a reference to my namespace if I was using Visual
Studio, but I don't have it, nor a command line compiler. Is it possible without
these?

Basically, I'm looking for an article that is entitled "how to create and reference
your own namespaces without visual studio".
I've tried putting my code behind and .cs file with my namespace in the bin directory
to no avail.

Any tips greatly appreciated
Cheers
Matt



Nov 19 '05 #4
Great, thanks Juan
Well, compiled code doesn't work by osmosis. :-)
Either you use the "src=" method, or you compile to an assembly
from the command-line, if you aren't using Visual Studio.

There's no getting around that.


So can a code behind .cs file use a "src=" to another .cs file then? One way
to find out I suppose!
Cheers
Matt
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2525
by: VK | last post by:
I have this code failing to work in IE: getElementsByTagName doesn't return elements from my JS namespace. What's wrong? <html xmlns:js> <head> <title>Que</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
3
2809
by: rdcpro | last post by:
Hi all, I've been building a nifty deserializing configuration handler that I use in conjunction with my web.config in an ASP.NET web app. This is working quite well, but I'm planning on servicing a number of different web service operations from a single application, and because it's all XML, I've been scoping everything to a specific namespace targeting a specific application (these are all InfoPath forms). It seems that the...
1
7269
by: Knecke | last post by:
Hi all. I have a problem with returning a custom Result object with webservice. The classes i use is described below (some fields and properties is removed) public class Result { int statusCode;
1
1227
by: John | last post by:
Hi I have created custom membership/role/profile providers as per the web.config below. My questions are; 1. Have I defined them correctly? 2. How can I make the Login and Create User Wizard controls to use these providers instead of the standard providers?
9
3133
by: wardy1975 | last post by:
Hi All, Looking for a little expert advice on a few web standards issues. I am currently trying to understand the impact of web standards for a web application I work with. I have been doing a lot of research in the areas of XHTML and WAI compliance, and am attempting to come up with a recommendation for our product in terms of standards level compliance. Ideally, I would like to be at XHTML 1.0 Strict. However, in my reading I have...
8
3627
by: Mark A. Sam | last post by:
Hello I am working locally with Visual Web Developer 2005 Express. Before I even installed it, the information from Microsoft was that you could FTP it to a remote site and it should work. The site I FTP'd to has .Net Framework 2.0 installed. I got this error when I tried to open the site: Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details...
1
2055
by: Ryan | last post by:
I am trying to log events to SQL Server instead of the computers event log, but, although I get no errors, I have no luck. The webevents_events table is empty. I have a custom event that I am raising (passwordchange), and can see it beign raised successfully...just it seems to go nowhere. I have run aspnet_regsql to setup the database to handle event recording. I am fairly sure I am missing something in my web.config file. (I would...
3
1626
by: stevong | last post by:
Hi, I've a custom user control: 'user1.ascx <script language="VB" runat="server"> Public str1 as string Dim conn as System.Data.SqlClient ' But this line hits and error. What should I do?
1
4436
Gulzor
by: Gulzor | last post by:
Hi, I have defined a set of custom tags that I put among regular HTML tags. E.g. <body> <div id="regular_id"> <namespace:container id="something" type="article" /> </div> </body>
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.