p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

aspdotnet_website_programming thread: Custom Server Control Question


Message #1 by andrew@s... on Thu, 20 Mar 2003 19:42:02
I am creating a custom control.  I need to read from an xml file at design 
time.  I place the xml file in the path where the .aspx file resides.

I have a property called XMLfile which stores its value in a string 
variable.  I would like to reference the file with 
HttpContext.Current.Request.MapPath(XmlFile).  This works at runtime, but 
not at design time.  How can I retrieve the contents of an xml file at 
design time which is placed in the current directory.  If I just use the 
path name, then windows looks at the system directory.

Thanks,

Andrew
Message #2 by "Will Swim" <wswim@p...> on Thu, 20 Mar 2003 11:51:04 -0800
Andrew,
I'm pretty new to .net so take it with a grain of salt. With that
out of the way I'll try to get ambiguous: depends on what you want
to do with the xml. If you just want the contents of the xml file
you can read it like a normal text file. If you want the data then
I'm sure there are several things but I don't know enough to tell
you all of them. You could try:(this is c#)

System.Data.Dataset myDataset = new System.Data.Dataset;
myDataset.ReadXml(XmlFile);

I don't know vb.net but it would be similar but the first line would
be something like
dim myDataset as new System.Data.Dataset
Hope that helps
Will

>
> I am creating a custom control.  I need to read from an
> xml file at design
> time.  I place the xml file in the path where the .aspx
> file resides.
>
> I have a property called XMLfile which stores its value
> in a string
> variable.  I would like to reference the file with
> HttpContext.Current.Request.MapPath(XmlFile).  This works
> at runtime, but
> not at design time.  How can I retrieve the contents of
> an xml file at
> design time which is placed in the current directory.  If
> I just use the
> path name, then windows looks at the system directory.
>
> Thanks,
>
> Andrew


  Return to Index