Associate a File to an Application for IE launch

Posted on 2005-04-25
Last Modified: 2012-08-13
In IE I have a link such as this..

<a href="reports/myreport.rpx">Click to Edit Report</a>

Then I have associated rpx on my PC with a program, from using open with and ticking the always.. box.

But IE still opens the file in an IE window

Is there anyway to force the machine to open the file using a program of my choice ?

I'm hoping its just a reg setting, but I couldn't find it. Access to the clients registry is not a problem for this application, since the report editor will be preinstalled from a setup program.
Question by:plq
    LVL 29

    Expert Comment

    Currently when you click on the link, the report is being streamed to the browser with a mime type of "text/html".

    To make it open in the correct program on the client machine will require you to stream the report to the browser with the correct mime type.

    You can find a mime type that the client machine wants for .rpx by checking the file association on the local computer. (HKEY_CLASSES_ROOT).

    If there is no mime type, or the mime type is used someplace else, e.g. text/plain, you probably won't be able to do what you want.  If it has a unique mime type, then you can change the mime type of your response from the web site to make it open in the default application.

    What is the mime type (if any)?

    LVL 8

    Author Comment

    There is no mime type. The rpx file actually contains XML (active reports from data dynamics)

    I have control over the app on the client that opens the rpx file (i.e. I have the source code in

    I don't know how i would tell the browser its a different mime type. Its opened with js:

      , "reporteditor");

    The web behind is standard asp - I suppose I could say

      "rpxlaunch.asp?file=" + sfile, "reporteditor");

    and in rpxlaunch.asp ...

    response.contenttype = "text/mymimetype" ?
    response.write ReadTextFile(Request.QueryString("file"))

    How does that sound?

    Here's a typical rpx file

    <?xml version="1.0" encoding="UTF-8"?>
    <ActiveReportsLayout Version="3" PrintWidth="14535" DocumentName="sysAssetRegisterByCategory" ScriptLang="C#" ShowParamUI="0" CodeFile="sysTest.vb">
        <Style Name="Normal" Value="font-family: 'Arial'; font-style: normal; font-variant: inherit; font-weight: normal; font-size: 10pt; font-size-adjust: inherit; font-stretch: inherit; color: rgb(0,0,0); background-color: inherit; background-image: inherit; background-repeat: inherit; background-attachment: inherit; opacity: inherit; word-spacing: inherit; letter-spacing: inherit; text-decoration: none; vertical-align: inherit; text-transform: inherit; text-align: inherit; text-indent: inherit; unicode-bidi: inherit; line-height: inherit; white-space: inherit; ddo-char-set: 0; " />
        <Style Name="Heading1" Value="font-family: 'inherit'; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 16pt; font-size-adjust: inherit; font-stretch: inherit; " />
        <Style Name="Heading2" Value="font-family: 'Times New Roman'; font-style: italic; font-variant: inherit; font-weight: bold; font-size: 14pt; font-size-adjust: inherit; font-stretch: inherit; " />
        <Style Name="Heading3" Value="font-family: 'inherit'; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 13pt; font-size-adjust: inherit; font-stretch: inherit; " />
        <Section Type="Detail" Name="Detail" Height="254" BackColor="16777215" KeepTogether="1" CanGrow="0">
          <Control Type="AR.Field" Name="txtCompanyCompanyDesc18" DataField="CostCentreName" MOD="4" Left="0" Top="0" Width="2000" Height="235" Text="CostCentreName" Style="color: rgb(0,0,0); ddo-char-set: 0; text-align: left; background-color: rgb(255,255,255); font-size: 8pt; " />
      <PageSettings />
    LVL 29

    Accepted Solution

    The web behind is standard asp - I suppose I could say

    "rpxlaunch.asp?file=" + sfile, "reporteditor");

    and in rpxlaunch.asp ...

    response.contenttype = "text/mymimetype" ?
    response.write ReadTextFile(Request.QueryString("file"))

    How does that sound?

    That soulds like a possibility, but to get it to work I think you will have to associate a mime type on the client computer.  I also went looking for a mime type related to rpx and could not find one.

    I think you are on the right track.
    LVL 8

    Author Comment

    This is working now. I can now open an rpx straight into my editor

    Here's the JS
"reportedit.asp?file=" + sfile, "reporteditor")

    Here's the reportedit.asp page (asp3 sadly)

          Response.ContentType = "application/rpx"
          sFile = Request.QueryString("file")
          Response.Write ReadTextFile(Server.MapPath(".") & "\" & Replace(sFile, "/", "\"), 0)
    Function ReadTextFile(sName, bUnicode)
        Dim scr
        Dim txt
        Dim sBuffer
        Dim lCount
        Set scr = CreateObject("Scripting.FileSystemObject")
        Set txt = scr.OpenTextFile(CStr(sName), 1, false, CBool(bUnicode))
        If txt.AtEndOfStream Then
            ReadTextFile = ""
            ReadTextFile = txt.ReadAll()
        End If
        Set txt = Nothing
        Set scr = Nothing
    End Function


    And here's the reg file needed on the client... this reg setting seems to make it use the windows default for rpx (e.g. open from windows explorer file association), which is just what I wanted

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/rpx]

    I am fairly sure this will be of interest to other activereports enduserdesigner developers :)

    thanks for helping

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now