473,237 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

a strange exception

when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException

can anyone tell me why and what to do??

m using VS2003 and i have iis 6 installed

thanks for time and for ur fast reply

Feb 5 '07 #1
5 1582
De************@gmail.com wrote in news:1170686589.072760.325720
@h3g2000cwc.googlegroups.com:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException

can anyone tell me why and what to do??

m using VS2003 and i have iis 6 installed

thanks for time and for ur fast reply
Probably because there is no current http context. You'll need to running a
web-application or the like as far as I know - not just a console app.

/Peter
Feb 5 '07 #2
Strange? Why would it be strange for there not to be any current HttpContext
in a desktop application? Web Application, yes, but not strange in a desktop
app.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"De************@gmail.com" wrote:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException

can anyone tell me why and what to do??

m using VS2003 and i have iis 6 installed

thanks for time and for ur fast reply

Feb 5 '07 #3
but i have no other option other than building the windows application
how can i refer to the server from my windows application

On Feb 5, 4:52 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Strange? Why would it be strange for there not to be any current HttpContext
in a desktop application? Web Application, yes, but not strange in a desktop
app.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"Developer.M...@gmail.com" wrote:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException
can anyone tell me why and what to do??
m using VS2003 and i have iis 6 installed
thanks for time and for ur fast reply- Hide quoted text -

- Show quoted text -

Feb 5 '07 #4
Since there is no HttpContext in your situation, you will need to use the
physical application path, or a UNC path if the IIS Application is on another
machine.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"De************@gmail.com" wrote:
but i have no other option other than building the windows application
how can i refer to the server from my windows application

On Feb 5, 4:52 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Strange? Why would it be strange for there not to be any current HttpContext
in a desktop application? Web Application, yes, but not strange in a desktop
app.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"Developer.M...@gmail.com" wrote:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException
can anyone tell me why and what to do??
m using VS2003 and i have iis 6 installed
thanks for time and for ur fast reply- Hide quoted text -
- Show quoted text -


Feb 5 '07 #5
iis is on the same machine.
isn't there other way to retrieve the physical path of a logical path
returned from the directoryServieces objects
On Feb 5, 5:28 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Since there is no HttpContext in your situation, you will need to use the
physical application path, or a UNC path if the IIS Application is on another
machine.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"Developer.M...@gmail.com" wrote:
but i have no other option other than building the windows application
how can i refer to the server from my windows application
On Feb 5, 4:52 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Strange? Why would it be strange for there not to be any current HttpContext
in a desktop application? Web Application, yes, but not strange in a desktop
app.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Developer.M...@gmail.com" wrote:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException
can anyone tell me why and what to do??
m using VS2003 and i have iis 6 installed
thanks for time and for ur fast reply- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Feb 5 '07 #6

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

Similar topics

0
by: Nedelcho Stanev | last post by:
Hello All, I have strange problem with libodbc++ ( 0.2.3 or 0.2.2 ). i'm using mysql-4.0.14 , MyODBC-3.51.06 and unixODBC-2.2.6 configured with following options 1.MySQL ../configure...
2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
3
by: Don McNamara | last post by:
Hi, I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on...
3
by: nick | last post by:
The program runs well on Local harddisk. But it always popup the exception if I run it on Netware mapping disk. After debugger say there is no source code on the exception. Also the following error...
2
by: Chris | last post by:
Hi, a strange behaviour when working with exceptions : when I divide and integer by 0 will an exception be thrown. OK but, when I divide a double by 0 is no exception thrown ??? How come ? ...
1
by: Chris | last post by:
Hi, a strange behaviour when working with exceptions : when I divide and integer by 0 will an exception be thrown. OK but, when I divide a double by 0 is no exception thrown ??? How come ? ...
0
by: Mark | last post by:
Hi - I have a really strange problem - straight forward login code (on the event of a button press). Works perfectly locally - but when I upload to my host, I get the message and stack shown...
10
by: John Kraft | last post by:
Hello all, I'm experiencing some, imo, strange behavior with the StreamReader object I am using in the code below. Summary is that I am downloading a file from a website and saving it to disk...
3
by: Anup Daware | last post by:
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception:...
13
by: Jen | last post by:
One user of my application is experiencing an exception "input string not in correct format". But it makes no sense where it is occurring. It is occurring when a string from a textbox ("172") is...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.