Re: Accessing server resources from remotable object

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Sam Santiago (ssantiago_at_n0spam-SoftiTechture.com)
Date: 08/12/04


Date: Thu, 12 Aug 2004 08:58:37 -0700

The proxy is just that - a proxy. The method will be executed on your
remote object, so the file will be written on the remoting host's file
system. Assuming of course you are marshaling-by-reference - your remote
object is derived from MarshalByRefObject. Server.MapPath() should work.
It should return the physical path associated with any virtual directory you
specify. Just be sure you have write access to that physical directory for
the identity your remote objects/ASP.NET application are running under.

Good luck.

Thanks,

Sam

-- 
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTechture.com
_______________________________
"sprungli" <sprungli1@netscape.net> wrote in message
news:OmEojcHgEHA.1196@TK2MSFTNGP11.phx.gbl...
> Thank you Sam,
>
> your reply was helpful. I have been wondering though: if the client, where
> the proxy of the remote object executes, happens to have the same file
> c:\webapps\clientfiles\MyFile.xml, aren't changes going to be written
there
> instead of on the server. I ask because I do not have a network where to
> test. Also, is there a way to use my host's Server.MapPath() method to get
> to the physical path of server files? Or to somehow extract such info from
> the web.config? What would you do in my place?
>
> TIA for any suggestions
>
> Best regards.
>
> ---
>
> "Sam Santiago" <ssantiago@n0spam-SoftiTechture.com> wrote in message
> news:eFzXtMDgEHA.1656@TK2MSFTNGP09.phx.gbl...
> > Your remoting host is on the IIS server, so you can have the remote
object
> > write to a physical path.  Pass the dataset to the remote object and
have
> > the remote object persist it to a physical directory that is also
exposed
> as
> > a virtual directory.  Your clients can then access the persisted file
via
> > the virtual directory and http.  For example,
> >
> > 1)  You have a physical directory on the IIS server,
> C:\webapps\clientfiles.
> > Give write permission to appropriate identities.
> >
> > 2) You create a virtual directory named
http://MyServer/MyHost/SavedFiles
> > that points to C:\webapps\clientfiles
> >
> > 3) Create a method on your remote object that accepts a dataset as a
> > parameter.  Persist the dataset to the directory c:\webapps\clientfiles.
> > Use a naming convention specific to each client if you are going to
expect
> > each client to have a unique file.  Let's say you create the file named
> > MyFile.xml.
> >
> > 4)  You clients can then access the file as
> > http://MyServer/MyHost/SavedFiles/MyFile.xml if needed.
> >
> > Thanks,
> >
> > Sam
> >
> > -- 
> > _______________________________
> > Sam Santiago
> > ssantiago@n0spam-SoftiTechture.com
> > http://www.SoftiTechture.com
> > _______________________________
> > "sprungli" <sprungli1@netscape.net> wrote in message
> > news:uRvZt1BgEHA.140@TK2MSFTNGP12.phx.gbl...
> > > In a remotable class I have to persist the content of a DataSet to a
> disk
> > > file. The file resides in the remoting host, a web application in IIS.
> > > However, the WriteXml method of the DataSet does not support URI
> formats,
> > so
> > > I cannot use something like:
> > > ds.WriteXml(@"http://MyServer/MyHost/MyFile.xml",
> > XmlWriteMode.WriteSchema).
> > > My clients should be able to choose a file to write to only on the
> network
> > > or the internet, so passing the physical path to the file is not an
> > option.
> > > How can I write to http://MyServer/MyHost/MyFile.xml from my remotable
> > > object?
> > >
> > > TIA
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: Hosting On IIS
    ... > 1) You're mixing two means of activating your object in your client code. ... >> I create a virtual directory named Test and copy these dlls in this ... >> directory to host remote object on IIS. ... >> configuration file for configuration. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Hosting On IIS
    ... > I create a virtual directory named Test and copy these dlls in this ... > directory to host remote object on IIS. ... > string GetCurrentSong(); ... > namespace RemotingServer ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Hosting On IIS
    ... Actually this is problem about Remoting. ... Create a virtual directory on IIS. ... In client app, when using Activator.GetObject ... >> directory to host remote object on IIS. ...
    (microsoft.public.dotnet.framework.remoting)
  • Hosting On IIS
    ... I create a virtual directory named Test and copy these dlls in this ... directory to host remote object on IIS. ... configuration file for configuration. ... namespace RemotingServer ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Accessing server resources from remotable object
    ... Your remoting host is on the IIS server, so you can have the remote object ... write to a physical path. ... Your clients can then access the persisted file via ... the virtual directory and http. ...
    (microsoft.public.dotnet.framework.remoting)