|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Starting question: picture location.I have a Webcontrol ( Inherits System.Web.UI.WebControls.WebControl, Visual Basic ). In this control I create and save a picture: Dim objImgResult As Image .... objImgResult.Save(strFilename) It works fine, but when I don't specify the full path in 'strFilename', the resulting image ends up in my "\Windows\system32" directory. But I want it to end up in the directory where the main file "Index.aspx" is, or in its "\bin" directory where the dll is with the control. How does one do this simple task, without hardcoding the full path into the code of the control? Thanks. You can use Server.MapPath("~");
The ~ means "Base dir". So, for example, wherever you are, "~/images" will always point to your images directory, if you have one. It's an absolute gem, and I'd like to thank the Spanish Govt for lending it to the .NET community. Show quoteHide quote "Qwert" <n***@nosp.com> wrote in message news:gJWdnUXtquyctx7fRVnyhQ@casema.nl... > Hello, > > I have a Webcontrol ( Inherits System.Web.UI.WebControls.WebControl, Visual > Basic ). > In this control I create and save a picture: > > Dim objImgResult As Image > ... > objImgResult.Save(strFilename) > > It works fine, but when I don't specify the full path in 'strFilename', the > resulting image ends up in my "\Windows\system32" directory. But I want it > to end up in the directory where the main file "Index.aspx" is, or in its > "\bin" directory where the dll is with the control. > > How does one do this simple task, without hardcoding the full path into the > code of the control? > > Thanks. > > > > > Use Server.MapPath to convert a URL to a full file path.
-- Show quoteHide quoteHTH, Kevin Spencer Microsoft MVP ..Net Developer What You Seek Is What You Get. "Qwert" <n***@nosp.com> wrote in message news:gJWdnUXtquyctx7fRVnyhQ@casema.nl... > Hello, > > I have a Webcontrol ( Inherits System.Web.UI.WebControls.WebControl, > Visual Basic ). > In this control I create and save a picture: > > Dim objImgResult As Image > ... > objImgResult.Save(strFilename) > > It works fine, but when I don't specify the full path in 'strFilename', > the resulting image ends up in my "\Windows\system32" directory. But I > want it to end up in the directory where the main file "Index.aspx" is, or > in its "\bin" directory where the dll is with the control. > > How does one do this simple task, without hardcoding the full path into > the code of the control? > > Thanks. > > > > > Thanks both, it gets the correct location.
Show quoteHide quote "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> schreef in bericht news:eMk9YpuVFHA.3188@TK2MSFTNGP09.phx.gbl... > Use Server.MapPath to convert a URL to a full file path. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > .Net Developer > What You Seek Is What You Get. > > "Qwert" <n***@nosp.com> wrote in message > news:gJWdnUXtquyctx7fRVnyhQ@casema.nl... >> Hello, >> >> I have a Webcontrol ( Inherits System.Web.UI.WebControls.WebControl, >> Visual Basic ). >> In this control I create and save a picture: >> >> Dim objImgResult As Image >> ... >> objImgResult.Save(strFilename) >> >> It works fine, but when I don't specify the full path in 'strFilename', >> the resulting image ends up in my "\Windows\system32" directory. But I >> want it to end up in the directory where the main file "Index.aspx" is, >> or in its "\bin" directory where the dll is with the control. >> >> How does one do this simple task, without hardcoding the full path into >> the code of the control? >> >> Thanks. >> >> >> >> >> > >
Why don't child control events trigger OnBubbleEvent?
Datalist - Image loads on localhost but not on server About CreateChildControls() Looking for an Autocomplete DropDownList looking for tab control / tabstrip in VS 2005 beta2 Multiple Label tags with same ID Validation on dynamic fields Object reference not set to an instance of an object - newpost Datagrid ... is this the control from hell? What is .Net equivilent of Fieldset/Legend |
|||||||||||||||||||||||