468,296 Members | 1,269 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,296 developers. It's quick & easy.

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 1452
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Nedelcho Stanev | last post: by
2 posts views Thread by Paul Drummond | last post: by
reply views Thread by Mark | last post: by
10 posts views Thread by John Kraft | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.