Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening file in browser

    Hi guys

    I'm a novice when it come to asp.net or all things web developing really. But i managed to create a web page that look into a database and then publishes a link to either a .doc, .pdf, etc

    Html link simpley calls something like file://myserver/docs/example.doc

    this process works fine in IE8 and IE9 but for some reason it doesn't work in Chrome or Firefox!

    does anyone know how to get this to work?

    A copy of the code is below

    Code:
    <html>
    <head runat="server">
        <title>Doc Index</title>
        <link rel="stylesheet" type="text/css" href="mystyle.css" />
    </head>
    
    <body>
    <img src="/Docindex/name.PNG" width="100" height="50" />
    <br><br><br>
    <h1 style="text-align:center;"><u>Document Index</u></h1>
    
        <form id="form1" runat="server">
    	<asp:AccessDataSource 
                ID="AccessDataSource1" runat="server" DataFile="G:\Builds\goldbuild.mdb" 
                SelectCommand="SELECT [CustomerID], [LongName] FROM [Customer] ORDER BY [LongName]">
            </asp:AccessDataSource>
    
            <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="Arial" 
                style="margin-left: 25%" Font-Size="Small" Text="Customers:"></asp:Label>
            <asp:DropDownList ID="DropDownList1" runat="server" Height="36px" 
                style="margin-left: 2px" Width="350px" AutoPostBack="True" 
                DataSourceID="AccessDataSource1" DataTextField="LongName" 
                DataValueField="CustomerID">
            </asp:DropDownList>
        </p>
        <p>
            <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
                DataFile="G:\Builds\goldbuild.mdb" 
                SelectCommand="SELECT [DocName], [FileName], [CustomerID] FROM [Documents] WHERE ([CustomerID] = ?)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="CustomerID" 
                        PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:AccessDataSource>
        </p>
    	<div align="center">
              <asp:DataList ID="DataList1" runat="server" 
                BorderColor="Black" BorderStyle="Double" BorderWidth="5px" CellPadding="0" 
                DataKeyField="DocName" DataSourceID="AccessDataSource2" ForeColor="Black" 
                GridLines="Horizontal" style="margin-left: 0%" Width="60%">   
                <ItemTemplate>
    	</div>
    	<div align="left">
                    <asp:HyperLink ID="HyperLink1" runat="server"
                        NavigateUrl='<%# Eval("FileName") %>' Text='<%# Eval("DocName") %>' Font-Size="Small" style="margin-left: 2%"></asp:HyperLink>
                    <br />
                    <br />
                </ItemTemplate>
                <SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            </asp:DataList>
    	</div>
    
        </p>
        </form>
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    103
    Thanks
    0
    Thanked 14 Times in 14 Posts
    Quote Originally Posted by paul.vickers View Post
    Hi guys

    I'm a novice when it come to asp.net or all things web developing really. But i managed to create a web page that look into a database and then publishes a link to either a .doc, .pdf, etc

    Html link simpley calls something like file://myserver/docs/example.doc

    this process works fine in IE8 and IE9 but for some reason it doesn't work in Chrome or Firefox!

    does anyone know how to get this to work?

    A copy of the code is below

    Code:
    <html>
    <head runat="server">
        <title>Doc Index</title>
        <link rel="stylesheet" type="text/css" href="mystyle.css" />
    </head>
    
    <body>
    <img src="/Docindex/name.PNG" width="100" height="50" />
    <br><br><br>
    <h1 style="text-align:center;"><u>Document Index</u></h1>
    
        <form id="form1" runat="server">
    	<asp:AccessDataSource 
                ID="AccessDataSource1" runat="server" DataFile="G:\Builds\goldbuild.mdb" 
                SelectCommand="SELECT [CustomerID], [LongName] FROM [Customer] ORDER BY [LongName]">
            </asp:AccessDataSource>
    
            <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="Arial" 
                style="margin-left: 25%" Font-Size="Small" Text="Customers:"></asp:Label>
            <asp:DropDownList ID="DropDownList1" runat="server" Height="36px" 
                style="margin-left: 2px" Width="350px" AutoPostBack="True" 
                DataSourceID="AccessDataSource1" DataTextField="LongName" 
                DataValueField="CustomerID">
            </asp:DropDownList>
        </p>
        <p>
            <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
                DataFile="G:\Builds\goldbuild.mdb" 
                SelectCommand="SELECT [DocName], [FileName], [CustomerID] FROM [Documents] WHERE ([CustomerID] = ?)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="CustomerID" 
                        PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:AccessDataSource>
        </p>
    	<div align="center">
              <asp:DataList ID="DataList1" runat="server" 
                BorderColor="Black" BorderStyle="Double" BorderWidth="5px" CellPadding="0" 
                DataKeyField="DocName" DataSourceID="AccessDataSource2" ForeColor="Black" 
                GridLines="Horizontal" style="margin-left: 0%" Width="60%">   
                <ItemTemplate>
    	</div>
    	<div align="left">
                    <asp:HyperLink ID="HyperLink1" runat="server"
                        NavigateUrl='<%# Eval("FileName") %>' Text='<%# Eval("DocName") %>' Font-Size="Small" style="margin-left: 2%"></asp:HyperLink>
                    <br />
                    <br />
                </ItemTemplate>
                <SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            </asp:DataList>
    	</div>
    
        </p>
        </form>
    </body>
    </html>
    Hello,

    Please paste the server side code for file downloading to get more idea

    Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •