VirtualPathProvider and mimetype (for RESTful applications)

Discussion in 'ASP .Net' started by forge1968, Apr 26, 2007.

  1. forge1968

    forge1968 Guest

    I want to handle URLs like this on my IIS site:

    http://localhost/myapp/REST/foo/1 ('REST/foo/1' doesn't exist - I'll
    dynamically create the content).

    I have implemented my own VirtualPathProvider and VirtualFile classes
    to do this. However, the mimetype of the response is 'application/
    octet-stream'. I want it to be 'text/xml'.

    Changing HttpContext.Current.Response.ContentType does not affect the
    response.

    The only way I've found is to append a '.xml' to the URL:

    http://localhost/myapp/REST/foo/1.xml

    This is *really* ugly....

    How can I change the response mimetype from within my custom
    VirtualFile class?

    I'm using .NET 2 and IIS 5 & 6.

    Thanks in advance for any help!

    M.D.
     
    forge1968, Apr 26, 2007
    #1
    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. =?Utf-8?B?RGFuaWVsIENoYWl0?=

    HtmlInputFile: mimetype of image/jpeg vs image/pjpeg?

    =?Utf-8?B?RGFuaWVsIENoYWl0?=, Oct 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,057
    =?Utf-8?B?RGFuaWVsIENoYWl0?=
    Oct 20, 2004
  2. =?Utf-8?B?UGF0cmljayBG?=

    Mimetype .aspx?

    =?Utf-8?B?UGF0cmljayBG?=, Mar 11, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    22,874
    oliiix
    Jun 30, 2007
  3. =?Utf-8?B?S2Vubnk=?=

    Problem with VirtualPathProvider

    =?Utf-8?B?S2Vubnk=?=, Apr 30, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,189
    =?Utf-8?B?S2Vubnk=?=
    Apr 30, 2006
  4. VV

    virtualpathprovider

    VV, Feb 20, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    520
  5. Charles Zhang

    Dynamic web pages using VirtualPathProvider

    Charles Zhang, Jun 15, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    641
    Walter Wang [MSFT]
    Jun 21, 2007
  6. Jan
    Replies:
    2
    Views:
    495
  7. Sriram Srivatsan

    VirtualPathProvider and Application Restart

    Sriram Srivatsan, Aug 11, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    772
    Sriram Srivatsan
    Aug 11, 2008
  8. rh0dium
    Replies:
    2
    Views:
    451
    Rami Chowdhury
    Sep 12, 2009
Loading...