Connecting Tech Pros Worldwide Forums | Help | Site Map

a strange exception

Developer.Man4@gmail.com
Guest
 
Posts: n/a
#1: Feb 5 '07
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


Peter K
Guest
 
Posts: n/a
#2: Feb 5 '07

re: a strange exception


Developer.Man4@gmail.com wrote in news:1170686589.072760.325720
@h3g2000cwc.googlegroups.com:
Quote:
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
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
 
Posts: n/a
#3: Feb 5 '07

re: a strange exception


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.Man4@gmail.com" wrote:
Quote:
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
>
>
Developer.Man4@gmail.com
Guest
 
Posts: n/a
#4: Feb 5 '07

re: a strange exception


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:
Quote:
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:
Quote:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException
>
Quote:
can anyone tell me why and what to do??
>
Quote:
m using VS2003 and i have iis 6 installed
>
Quote:
thanks for time and for ur fast reply- Hide quoted text -
>
- Show quoted text -

=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
 
Posts: n/a
#5: Feb 5 '07

re: a strange exception


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.Man4@gmail.com" wrote:
Quote:
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:
Quote:
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:
Quote:
when i try using HttpContext.Current.Server.MapPath(path) from a
desktop application built using c# i get a
System.NullReferenceException
Quote:
can anyone tell me why and what to do??
Quote:
m using VS2003 and i have iis 6 installed
Quote:
thanks for time and for ur fast reply- Hide quoted text -
- Show quoted text -
>
>
>
Developer.Man4@gmail.com
Guest
 
Posts: n/a
#6: Feb 5 '07

re: a strange exception


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:
Quote:
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:
Quote:
but i have no other option other than building the windows application
how can i refer to the server from my windows application
>
Quote:
On Feb 5, 4:52 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
Quote:
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
>
Quote:
>
Quote:
Quote:
"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
>
Quote:
Quote:
can anyone tell me why and what to do??
>
Quote:
Quote:
m using VS2003 and i have iis 6 installed
>
Quote:
Quote:
thanks for time and for ur fast reply- Hide quoted text -
>
Quote:
Quote:
- Show quoted text -- Hide quoted text -
>
- Show quoted text -

Closed Thread