Accessing Server.MapPath from within Custom Controls Render() method?

Discussion in 'ASP .Net Web Controls' started by Kenneth Baltrinic, Oct 16, 2003.

  1. I am writing a simple custom control to read in an rtf file, convert it to
    HTML and output the HTML. I ran into one little glitch. My control has a
    FileName property, the value of which I want to convert from a relative path
    to get the actual file path on the server. I need MapPath for this but I
    don't have access to an HTTPServerUtility object (the class of object
    returned by Page.Server) inside the Render method. Any suggestions?

    --Ken Baltrinic
     
    Kenneth Baltrinic, Oct 16, 2003
    #1
    1. Advertisements

  2. Kenneth Baltrinic

    IgorW Guest

    Try this(Me in VB.NET).Page.Request....
    HttpRequest.FilePath
    or HttpRequest.Path
    or HttpRequest.PhysicalPath




    Am Wed, 15 Oct 2003 20:50:05 -0400 hat Kenneth Baltrinic
    <> geschrieben:

    > I am writing a simple custom control to read in an rtf file, convert it
    > to
    > HTML and output the HTML. I ran into one little glitch. My control has
    > a
    > FileName property, the value of which I want to convert from a relative
    > path
    > to get the actual file path on the server. I need MapPath for this but I
    > don't have access to an HTTPServerUtility object (the class of object
    > returned by Page.Server) inside the Render method. Any suggestions?
    >
    > --Ken Baltrinic
    >
    >
     
    IgorW, Oct 16, 2003
    #2
    1. Advertisements

  3. Kenneth Baltrinic

    Rajesh.V Guest

    Use a custom designer class,and override the function
    GetDesignTimeHtml() method.

    The link for the same is

    http://msdn.microsoft.com/library/d...n-us/cpguide/html/cpconhtmldesignersample.asp

    "Kenneth Baltrinic" <> wrote in message
    news:%...
    > I am writing a simple custom control to read in an rtf file, convert it to
    > HTML and output the HTML. I ran into one little glitch. My control has a
    > FileName property, the value of which I want to convert from a relative

    path
    > to get the actual file path on the server. I need MapPath for this but I
    > don't have access to an HTTPServerUtility object (the class of object
    > returned by Page.Server) inside the Render method. Any suggestions?
    >
    > --Ken Baltrinic
    >
    >
     
    Rajesh.V, Oct 16, 2003
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vivek Sawant
    Replies:
    3
    Views:
    318
    Peter Hansen
    Feb 18, 2004
  2. =?Utf-8?B?dHBhcmtzNjk=?=

    server.mappath vs. request.mappath

    =?Utf-8?B?dHBhcmtzNjk=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,539
    Juan T. Llibre
    Mar 11, 2007
  3. user
    Replies:
    1
    Views:
    566
    Kevin Spencer
    Jul 19, 2007
  4. Replies:
    4
    Views:
    1,267
    Juan T. Llibre
    Oct 7, 2007
  5. Demetri

    Controls within Custom Control Don't Render

    Demetri, Dec 5, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    253
    Mark Fitzpatrick
    Dec 5, 2003
  6. PA

    Accessing Server.Mappath from SoapExtension

    PA, May 19, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    229
    Dino Chiesa [Microsoft]
    May 19, 2004
  7. sean

    server.mappath method - please help

    sean, Dec 4, 2003, in forum: ASP General
    Replies:
    1
    Views:
    187
    Atrax
    Dec 4, 2003
  8. Glenn Gillen
    Replies:
    0
    Views:
    500
    Glenn Gillen
    Nov 17, 2006
Loading...