Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

Last post 05-11-2008 8:48 PM by dave_smith. 5 replies.

Sort Posts:

  • Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

    05-06-2008, 4:22 AM
    • Loading...
    • dave_smith
    • Joined on 10-09-2007, 11:47 AM
    • Posts 9

     I am trying to provide a dealer list by province using Access as the data source. The DB has 1 table with the dealers.

     I am using asp .net 2.0

    I wish to filter or pass a parameter or whatever through an asp link to  the dealers webpage so that it only brings up the dealers for that province.

    Each province and territory are links on the home page. I don't want a drop down list.

     

    The webpage I made using the Access,  Gridview control using ItemTemplate provides the proper results if viewed locally using the .net development server. It doesn't work at all or produce a debug code whwhen debug is turned on when placed in the web.config file on the webhost, Netfirms.com.

     

    I've been working to learn .Net 2.0 for days trying to go through the great tutorials here but I must be missing something.

    I  want to let users viewing the webpage  view the list of dealers for that province sorted by city.

    This runs perfectly on my local development server but is dead on the Netfirms.com web hosting server 

     

    Note that the form is part of the master page and the master page has "form1" run at server etc 

    The code for the child page is :

      

    1    <%@ Page Language="C#" MasterPageFile="~/1main_en.master" AutoEventWireup="true" %>
    2 "Content1" ContentPlaceHolderID="head" Runat="Server">
    3 Dealers
    4 "styles/main.css" rel="stylesheet" type="text/css" />
    5 6 "Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    7
    8
    9 10 "Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    11 12 "GridView1" runat="server" AutoGenerateColumns="False" 13 DataSourceID="AccessDataSource1">
    14 15 "Dealers Sorted by City" SortExpression="Calccity">
    16 17
    "width:785px;padding:0px;margin:0px 0px 7px 0px;border-bottom:2px #CCCCCC solid">
    18
    "float:right;width:465px;" >
    19 "DURASPIN" runat="server" Text='<%# Bind("DURASPINA") %>'> 20 "SENCO" runat="server" Text='<%# Bind("SENCOA") %>'> 21 "ENERFOAM" runat="server" Text='<%# Bind("ENERFOAMA") %>'> 22 "TYREX" runat="server" Text='<%# Bind("TYREXA") %>'> 23 "DURAFOAM" runat="server" Text='<%# Bind("DURAFOAMA") %>'> 24 "IRONCLAD" runat="server" Text='<%# Bind("IRONCLADA") %>'> 25 "ISM" runat="server" Text='<%# Bind("ISMA") %>'> 26 "MAX" runat="server" Text='<%# Bind("MAXA") %>'> 27 "RFOIL" runat="server" Text='<%# Bind("RFOILA") %>'> 28 "SAMUEL" runat="server" Text='<%# Bind("SAMUELA") %>'> 29 "TAPSET" runat="server" Text='<%# Bind("TAPSETA") %>'> 30 "TURBINAIRE" runat="server" Text='<%# Bind("TURBINAIREA") %>'> 31 "VENTURE" runat="server" Text='<%# Bind("VENTUREA") %>'> 32
    33
    34
    "width:300px;padding:0px;">"CustName" CssClass="dealer_name" runat="server" Text='<%# Bind("Calcname") %>'> 35
    36 "Addr1" runat="server" Text='<%# Bind("Calcaddr1") %>'>,
    37 "Addr2" runat="server" Text='<%# Bind("Calcaddr2") %>'> 38
    39 "City" CssClass="bold" runat="server" Text='<%# Bind("Calccity") %>'>,
    40 "State" runat="server" Text='<%# Bind("Calcstate") %>'>
    41 "Zip" runat="server" Text='<%# Bind("Calczip") %>'> 42
    43 Tel: "TEL" runat="server" Text='<%# Bind("Telchar") %>'>   
    44 Fax: "FAX" runat="server" Text='<%# Bind("Faxchar") %>'> 45

    46
    47
    48
    49
    50
    51
    52 "AccessDataSource1" runat="server" 53 DataFile="~/App_Data/SID_Dealers_Access2002-3.mdb" 54 SelectCommand="SELECT [Calcname], [Calcaddr1],[Calcaddr2], [Calccity], [Calcstate], [Calczip], [Faxchar], [Telchar], [DURASPINA], [SENCOA], [ENERFOAMA], [TYREXA], [DURAFOAMA], [IRONCLADA], [ISMA], [MAXA], [RFOILA], [SAMUELA], [TAPSETA], [TURBINAIREA], [VENTUREA] FROM [SID_Dealers] ORDER BY [Calcstate], [Calccity]">
    55 56
     

     Any help would be appreciated.

     

    Thanks in advance 

    DSmith 

     

     

     

  • Re: Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

    05-06-2008, 5:25 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,533
    What exactly the error comes from the server ?
    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

    05-06-2008, 4:54 PM
    • Loading...
    • dave_smith
    • Joined on 10-09-2007, 11:47 AM
    • Posts 9

     Thanks for the reply.

    If I turn on debugging in the web.config file and run it on the webhosting at netfirms. com it just goes to the custom error page 404.

    It runs fine on the local development server for .net 2.0  without error messages. The Access db is in the App_Data   folder. I just want to show the records for dealers shown by city for a specific province and format it so it looks normal. ie

    Dealer name

    Addr1, Addr2

    City , Province Postal code

    Tel: 999-999-9999  fax: 999-999-999 

    On the right div it shows the brand names and later I will change these to show the brand logos 

    I started to develop this using  3 layer model and then had problems with the strong dataset so I just used the connection in that webpage which directly uses the Access db seems to work on my local development server.

    Does this code look alright? 

    It lists the dealer name, address and phone numbers on the left div and the brands carried on the right div all within a div for each record which is within the ItemTemplate 1 column setup so that I can format the name address and phone numbers.

    I DO NOT want anyone to update/change/insert any records...just show the record. I want to just ftp the access db file once a month to the website.
     

    Any ideas would be appreciated. 

    Dave Smith 

     

  • Re: Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

    05-08-2008, 11:49 PM
    • Loading...
    • dave_smith
    • Joined on 10-09-2007, 11:47 AM
    • Posts 9

     On later inspection this appears to be an issue with the shared webhosting security.

    I may be wrong but this shows an error inthe browser when viewing the website on the internet but not the local development server

    _________________________ 

    Security Exception

    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

    Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    __________________________-

    NETFIRMS.com, the webhost of this shared hosting plan states:

    Medium Trust Level is the recommended default for hosters. Code in Medium trust applications can read and write its own application directories and can interact with SQL Serverâ„¢ databases. Medium trust is the recommended setting for a shared server because it allows connections to SQL Server databases and restricts all other permissions to the application root structure.

    Medium Trust Summary is available directly from Microsoft's website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000020.asp 
     
    The main constraints placed on medium trust Web applications are:

    1. OleDbPermission is not available. This means you cannot use the ADO.NET managed OLE DB data provider to access databases. However, you can use the managed SQL Server provider to access SQL Server databases.
    2. EventLogPermission is not available. This means you cannot access the Windows event log.
    3. ReflectionPermission is not available. This means you cannot use reflection.
    4. RegistryPermission is not available. This means you cannot access
    the registry
    5. WebPermission is restricted. This means your application can only communicate with an address or range of addresses that you define in the <trust> element.

    6. FileIOPermission is restricted. This means you can only access files in your application's virtual directory hierarchy. Your application is granted Read, Write, Append, and PathDiscovery
    permissions for your application's virtual directory hierarchy.
    7. You are also prevented from calling unmanaged code or from using Enterprise Services.

     __________________________

     

    I take it that I can run the Access DB if I change the trust element in the root directory but I gcan't get it to work. I'm doing something wrong.

    In the root directory web.config I put < trust level="Medium" originUrl="" /> right after the <system.web> but that messes up the website.

    What's the correct place to put this and the correct syntax? What goes in the quotations after originURL=   ?

    The Access DB is in the App_Data folder 

     

     


     

     

     

  • Re: Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

    05-09-2008, 2:20 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,533
    Have u grant Aspnet [and NetworkService] account the full permission on AccessDB ?
    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Access - view Gridview , Itemtemplate Works on local dev server NOT Netfirms webhost

    05-11-2008, 8:48 PM
    • Loading...
    • dave_smith
    • Joined on 10-09-2007, 11:47 AM
    • Posts 9

     It's a shared web hosting account. The host sets the trust to medium as per Microsoft's website directions for shared web hosting plans. I took a look at the MSDN

     

     

Page 1 of 1 (6 items)