Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Possible web.Config problem 1

Status
Not open for further replies.

toddw607

Programmer
Joined
Apr 2, 2007
Messages
55
Location
US
Hi Everyone!
I have a aspx page that when accessed through the web server it brings up a dropdown box connected to names of three different .aspx pages which are derived from 3 different SQL Server 2000 tables. When bringing up the initial page and when a selection is made from the dropdown box it displays a 404 error.
I'm sure it is not the code (which I will include at the bottom) because when I bring up the actual .aspx page in visual basic and right click to "View in Browser" the page and the links work fine. Also, when trying to access the links directly (without using the dropdown box) they also come up with a 404 error. I think this probably has to do something with the web.config file but everytime I try to move the file from the parent directory of my folder, the main page does not even come up. I tried to place it within my folder but the same error is displayed. I think I may have to set up a different web.config for each page but I'm not sure how to do this and I also read that I shouldn't have to. Also, all 4 pages are located in the same folder. I think I have covered everything I'm away of but if there is anything else needed to attempt to solve this problem please let me know Thanks!!

Code for Initial page:
<%@ Page Language="VB" %>
<script language="VB" runat="server">

Sub Page_Load(sender As Object, e As EventArgs)
Dim blnAutoNav As Boolean

If Not Page.IsPostBack Then
' Create a new ListItemCollection
Dim myLocations As New ListItemCollection()

' Add items to the collection
myLocations.Add(New ListItem("Select a Table to Display", Request.ServerVariables("URL")))
myLocations.Add(New ListItem("ToddsTable1", "ToddsTable1.aspx"))
myLocations.Add(New ListItem("CA", "CA.aspx"))
myLocations.Add(New ListItem("XH", "XH.aspx"))

' Databind our DDL to the ListItemCollection we just filled
ddlLocations.DataSource = myLocations
ddlLocations.DataTextField = "Text"
ddlLocations.DataValueField = "Value"
ddlLocations.DataBind()
End If

' Find out current auto-navigation status and add JS to handle it if needed.
If Request.QueryString("auto") = "True" Then
blnAutoNav = True

' This adds the javascript to automatically redirect to the selected
' location whenever a new item is selected in the dropdownlist.
ddlLocations.Attributes("onchange") = "javascript:window.location = " _
& "document.frmNav.ddlLocations[document.frmNav.ddlLocations.selectedIndex].value;"
Else
blnAutoNav = False
End If


End Sub

Sub btnGo_Click(sender As Object, e As EventArgs)
Response.Redirect(ddlLocations.SelectedItem.Value)
End Sub

</script>

<html>
<head>
<title>Collection of Tables from SQL Server displayed in ASP.NET</title>
<script language="javascript" type="text/javascript">
// <!CDATA[

function TextArea1_onclick() {

}

// ]]>
</script>
</head>
<body style="vertical-align: middle; text-align: center" bgcolor="#cc3300">

<form id="frmNav" runat="server">
<br />
<asp:Label ID="Label1" runat="server" Height="40px" Text="Switchboard to run ASP.NET from SQL Server 2000" Width="248px" style="border-right: teal thin groove; border-top: teal thin groove; font-weight: bold; vertical-align: middle; border-left: teal thin groove; color: #ff0000; border-bottom: teal thin groove; text-align: center" BackColor="#E0E0E0"></asp:Label><br />
<br />
<br />

<asp:DropDownList id="ddlLocations" runat="server" BackColor="#E0E0E0" style="font-weight: bolder; color: red" />

<asp:Button id="btnGo" runat="server"
Text = "Go"
OnClick = "btnGo_Click"
/>
<br />
<br />
<br />
<br />
<br />
<br />

</form>

</body>
</html>

Code for secondary page:
<%@ Page Language="VB" Debug = "true"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<script runat="server">

</script>

<html xmlns=" >
<head runat="server">
<title>CA Table</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1" class="ex" width="100%">
<tr>
<td>
<pre>
&nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."
ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<Columns>
<asp:BoundField DataField="EIAC" HeaderText="EIAC" SortExpression="EIAC" />
<asp:BoundField DataField="LCN" HeaderText="LCN" SortExpression="LCN" />
<asp:BoundField DataField="ALC" HeaderText="ALC" SortExpression="ALC" />
<asp:BoundField DataField="LTY" HeaderText="LTY" SortExpression="LTY" />
<asp:BoundField DataField="TASK" HeaderText="TASK" SortExpression="TASK" />
<asp:BoundField DataField="REF_EIAC" HeaderText="REF_EIAC" SortExpression="REF_EIAC" />
<asp:BoundField DataField="REF_LCN" HeaderText="REF_LCN" SortExpression="REF_LCN" />
<asp:BoundField DataField="REF_ALC" HeaderText="REF_ALC" SortExpression="REF_ALC" />
<asp:BoundField DataField="REF_LTY" HeaderText="REF_LTY" SortExpression="REF_LTY" />
<asp:BoundField DataField="REF_TASK" HeaderText="REF_TASK" SortExpression="REF_TASK" />
<asp:BoundField DataField="AOR_LCN" HeaderText="AOR_LCN" SortExpression="AOR_LCN" />
<asp:BoundField DataField="AOR_ALC" HeaderText="AOR_ALC" SortExpression="AOR_ALC" />
<asp:BoundField DataField="AOR_LTY" HeaderText="AOR_LTY" SortExpression="AOR_LTY" />
<asp:BoundField DataField="AOR_MB" HeaderText="AOR_MB" SortExpression="AOR_MB" />
<asp:BoundField DataField="IDENT" HeaderText="IDENT" SortExpression="IDENT" />
<asp:BoundField DataField="FREQ" HeaderText="FREQ" SortExpression="FREQ" />
<asp:BoundField DataField="CC" HeaderText="CC" SortExpression="CC" />
<asp:BoundField DataField="HCP" HeaderText="HCP" SortExpression="HCP" />
<asp:BoundField DataField="HMPC" HeaderText="HMPC" SortExpression="HMPC" />
<asp:BoundField DataField="PMCS" HeaderText="PMCS" SortExpression="PMCS" />
<asp:BoundField DataField="MMET" HeaderText="MMET" SortExpression="MMET" />
<asp:BoundField DataField="PMET" HeaderText="PMET" SortExpression="PMET" />
<asp:BoundField DataField="MMMH" HeaderText="MMMH" SortExpression="MMMH" />
<asp:BoundField DataField="PMMH" HeaderText="PMMH" SortExpression="PMMH" />
<asp:BoundField DataField="PMD" HeaderText="PMD" SortExpression="PMD" />
<asp:BoundField DataField="SMD" HeaderText="SMD" SortExpression="SMD" />
<asp:BoundField DataField="FRC" HeaderText="FRC" SortExpression="FRC" />
<asp:BoundField DataField="TERC" HeaderText="TERC" SortExpression="TERC" />
<asp:BoundField DataField="TRT" HeaderText="TRT" SortExpression="TRT" />
<asp:BoundField DataField="TLR" HeaderText="TLR" SortExpression="TLR" />
<asp:BoundField DataField="TR" HeaderText="TR" SortExpression="TR" />
<asp:BoundField DataField="TRC" HeaderText="TRC" SortExpression="TRC" />
<asp:BoundField DataField="TPSA" HeaderText="TPSA" SortExpression="TPSA" />
<asp:BoundField DataField="TPSB" HeaderText="TPSB" SortExpression="TPSB" />
<asp:BoundField DataField="TPSC" HeaderText="TPSC" SortExpression="TPSC" />
<asp:BoundField DataField="TCA" HeaderText="TCA" SortExpression="TCA" />
<asp:BoundField DataField="TCB" HeaderText="TCB" SortExpression="TCB" />
<asp:BoundField DataField="TCC" HeaderText="TCC" SortExpression="TCC" />
<asp:CheckBoxField DataField="Baselined" HeaderText="Baselined" SortExpression="Baselined" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
</Columns>
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:upsizedCandidateConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:upsizedCandidateConnectionString1.ProviderName %>"
SelectCommand="SELECT [EIAC], [LCN], [ALC], [LTY], [TASK], [REF_EIAC], [REF_LCN], [REF_ALC], [REF_LTY], [REF_TASK], [AOR_LCN], [AOR_ALC], [AOR_LTY], [AOR_MB], [IDENT], [FREQ], [CC], [HCP], [HMPC], [PMCS], [MMET], [PMET], [MMMH], [PMMH], [PMD], [SMD], [FRC], [TERC], [TRT], [TLR], [TR], [TRC], [TPSA], [TPSB], [TPSC], [TCA], [TCB], [TCC], [Baselined], [Date] FROM [CA]">
</asp:SqlDataSource> </pre>
</td>
</tr>
</table>

</div>
</form>
</body>
</html>
 
This error can be caused by a virtual directory not being configured as an application in IIS.
Could this be the problem?


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Thanks, I think that should work but I'm really new @ this and I've been trying to configure my settings in the Admin folder on my own machine. Do i have to configure the IIS directly on the server? If so, how do I access this?
 
Do i have to configure the IIS directly on the server? If so, how do I access this?
Yes, you'll have to configure IIS on the server not your own machine. How you get access to this machine depends entirely on your situation...


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Thanks...I'll be looking into that...I'm pretty sure that the answer to my problems
 
I switched the servers from mailserver to sqlserver, which is where my SQL tables are and now there is not a trust issue between the machines and everything works ok. The only thing is that sqlserver is running on Windows NT server and .aspx is not supported. Can anyone tell me where I can download the .dll to place in the system32 folder so I can run these? I think I should be good after that. Thanks very much for everyone's help. I knew nothing about servers or asp.net yesterday morning but now I think I'll be good from here on out, hopefully. Thanks again!
 
not quite sure I follow. how can your application work, if asp.net is not configured on the server? Since SQL Server and Exchange are usally the 2 most important boxes on a network, it's not a good idea to install your app on those servers.

what you need is your SQL server box (already have this in place). You then need IIS running on a server. (could be same server, or a different server[prefered]). Then you need to adjust the connection string in the web.config to access the SQL server. After that configure IIS with a virtual directory for you application and configure the directory as an application. make sure the .net framework is installed on the IIS server. If it's IIS 6 make sure the proper extensions are enabled.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I have html and script in my .aspx file and it displays the html but not the script. It does not give an error message, it doesn't display anything. I looked in the application configuration and there is no .aspx extension in there just .asp but I need somewhere to reference the .aspx exntesion like an executable path for a dll which I can download. I have the .NET framework 2.0 on the server.
 
if aspx doesn't show up as an option, then IIS doesn't know the .net framework exists. If I remember correctly .net needs to be installed before IIS. this way IIS will grab .net extensions.

I'm not sure if restarting the IIS process will fix this problem, but it's worth a shot.

if the script (I assume javascript) is not loading correctly then the file is not on the server or it's not being referenced properly.

I would do some more research into IIS. the more we post the more it seems to be an IIS configuration issue and not a programming issue.

there may be an IIS forum on Tek-Tips that can help. there is also a forum at dedicated to IIS as well.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top