473,587 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How Can I locate a namespace reference in asp.net?

What is the best way to locate the namespace I need to put in a using
statement?

For example suppose I wanted to discover which namespace "Server" was
in the context of:

Exception ex = Server.GetLastE rror();

- code that is normally placed in Global Application_Err or() but which
I want to put in a separate class.

How do I go about finding which particular namespace has a Server
class which includes a GetLastError method?

Apr 27 '07 #1
4 3573
Keep in mind, when you're not coding in a web page or a user or web control
you need to use the full object path to get to things like the Server object
as such: HttpContext.Cur rent.Server
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"mark4asp" <ma******@gmail .comwrote in message
news:11******** **************@ r3g2000prh.goog legroups.com...
What is the best way to locate the namespace I need to put in a using
statement?

For example suppose I wanted to discover which namespace "Server" was
in the context of:

Exception ex = Server.GetLastE rror();

- code that is normally placed in Global Application_Err or() but which
I want to put in a separate class.

How do I go about finding which particular namespace has a Server
class which includes a GetLastError method?

Apr 27 '07 #2
re:
!What is the best way to locate the namespace I need to put in a using statement?

Look it up in the .Net Framework Class Browser :

http://quickstarts.asp.net/QuickStar...ssbrowser.aspx

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"mark4asp" <ma******@gmail .comwrote in message
news:11******** **************@ r3g2000prh.goog legroups.com...
What is the best way to locate the namespace I need to put in a using
statement?

For example suppose I wanted to discover which namespace "Server" was
in the context of:

Exception ex = Server.GetLastE rror();

- code that is normally placed in Global Application_Err or() but which
I want to put in a separate class.

How do I go about finding which particular namespace has a Server
class which includes a GetLastError method?

Apr 27 '07 #3
On 27 Apr, 13:01, "Mark Fitzpatrick" <markf...@fitzm e.comwrote:
Keep in mind, when you're not coding in a web page or a user or web control
you need to use the full object path to get to things like the Server object
as such: HttpContext.Cur rent.Server

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"mark4asp" <mark4...@gmail .comwrote in message

news:11******** **************@ r3g2000prh.goog legroups.com...
What is the best way to locate the namespace I need to put in a using
statement?
For example suppose I wanted to discover which namespace "Server" was
in the context of:
Exception ex = Server.GetLastE rror();
- code that is normally placed in Global Application_Err or() but which
I want to put in a separate class.
How do I go about finding which particular namespace has a Server
class which includes a GetLastError method?- Hide quoted text -

- Show quoted text -
Thanks Mark, I had problems finding the "HttpContext.Cu rrent.Server"
bit.

I figured it out - all incredibly simple once you realise that Google
is not your friend but your enemy. Visual Studio is your friend.

1) In Visual Studio I put the line:
Exception ex = Server.GetLastE rror();
some place where it works (i.e. where a specific reference to the
namespace is not required) and where a breakpoint can reasonably be
set [Global Application_Err or() won't do but
FormsAuthentica tion_OnAuthenti cate() is fine as that's in Global too]
2) add a breakpoint there.
3) start debugging
4) add a watch for the desired object (Server) which tells me:

+ Server {System.Web.Htt pServerUtility} System.Web.Http ServerUtility

Voila - the required namespace is "System.Web.Htt pServerUtility"

So in I can now call my custom class in Global Application_Err or():

string sError = CustomError.get Error(Context, Request, Server, ref
sMessage);

and the header for my class method in CustomError is:

public static string getError(HttpCo ntext Context, HttpRequest
Request, HttpServerUtili ty Server, ref string eMessage)

with no particular new using statements being needed in CustomError.

I feel the need to tell myself this even if everyone else already
knows it because it helps me remember things when I write them down.

Apr 27 '07 #4

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:uo******** ******@TK2MSFTN GP02.phx.gbl...
re:
!What is the best way to locate the namespace I need to put in a using
statement?

Look it up in the .Net Framework Class Browser :

http://quickstarts.asp.net/QuickStar...ssbrowser.aspx
You may also want to use the F1 button in Visual Web Developer or Visual
Studio.
Put the cursor on the word "Server" in your code, and press F1.

Usually, it will bring you straight to the right page with all the
information.

Riki
Apr 27 '07 #5

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

Similar topics

0
1328
by: shawnk | last post by:
I want to use the Hosts file to locate schema for validation. The Hosts file (C:\Windows\System32\etc) will locate xsd schema files on a LAN server for development purposes. This gives me a alias mechanism for XML namespace redirection. If the host file on a client machine has the entry; 192.168.1.12 XML-srv
3
1424
by: SC | last post by:
i have 2 separate projects: 1) Project A: Class library, written in VB.NET; It's namespace is explicitly defined in the code like: Namespace MyCompany.Project.ClassesA .... End Namespace 2) Project B: Classes written in C#. It looks like:
4
2407
by: Peter Speybrouck | last post by:
I have a little problem with a webservice. I reproduced the problem in the following simplified example. I just create a new C# ASP.NET webservice and a c# console application. I added a new class test to the namespace of the webservice which I try to access from the console application. //Service1.asmx.cs
4
1865
by: dhnriverside | last post by:
HI guys I've just written my first independent namespace for my library (yay me!). However, on trying to add it to my website project, it causes an error when I look at the website. It compiles ok though... The error message is... "The located assembly's manifest definition with name 'HudsonNash.Utils.Security' does not match the...
6
3403
by: ryan.d.rembaum | last post by:
Hello, I have code that I wish to use in many web applications. Basically sort of stand utility stuff. So from Visual Studio Project I select add a component and chose Component Class. Lets say I enter code at the end of this question in to the code section. How then would I reference this in a new Web Application (or in the same web...
1
2050
by: Phill. W | last post by:
Having changed a VB.Net(2003) DLL project, I'm getting Type Loading problems in other code that uses my DLL. In my source code, I have a Namespace Statement something like this: Namespace XYZ.AProject but when I build the DLL project and open the resulting DLL up in ILDASM, the Namespace has been *translated* to "XYZ.Aproject".
9
1318
by: Buz Waitz | last post by:
I'm a newbie. I've created a datalayer class which I creatively called sqlAccess and placed in a namespace I just as creatively called MyDomain.DataAccessLayer. (Well now, I didn't actually use "MyDomain" but you know how that works.) And now I'm working on the business logic layer. When I import the namespace, intellisense completes the name...
29
1852
by: Tiraman | last post by:
Hi, I Build my own dll with my own namespace name and i would like to put it in one place but for the project bin folder so all of the projects will be able to use it . i tried to put the dll in this place ----> c:\MyDlls\Test.dll And i wrote in my aspx file the following <%@ Import Namespace="Test.MyClass"%>
0
1257
by: CtrlAltDel2008 | last post by:
Hello everyone, i hope you can help me with this query. The code below all works fine, referring to the SUBSTRING part, at the moment it just displays all the text from the "http" part until the end of the thread. I am trying to get it to just grab the URL and display that only. $sql= <<< END SELECT post_date ,...
0
7923
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...
0
8216
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. ...
0
8349
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...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3845
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...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1192
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...

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.