By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,170 Members | 1,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,170 IT Pros & Developers. It's quick & easy.

a strange exception

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.