daddyrat
asked on
I get this error:
I created a StartPage.aspx trying to link to the database with a hyperlink to another called index.aspx.
I get this error when the page pops up, some data is display but no database(Access):
Could not find file 'c:\inetpub\wwwroot\BajaSa lsa\BajaSa lsa.mdb'.
My Hyperlink:
<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 32px" runat="server" Font-Size="XX-Large" BorderStyle="Double" BackColor="Yellow" BorderColor="Red" Font-Names="Trebuchet MS" ForeColor="Firebrick" NavigateUrl="index.aspx" Target="_new">Customers</a sp:HyperLi nk>
The page I'm trying to hyperlink to:
Public Class index
Inherits System.Web.UI.Page
Protected WithEvents lblCart As System.Web.UI.WebControls. Label
Private DTRProducts As System.Data.OleDb.OleDbDat aReader
Private DTRCategory As System.Data.OleDb.OleDbDat aReader
Private DB As New System.Data.OleDb.OleDbCon nection
Protected WithEvents HyperLink1 As System.Web.UI.WebControls. HyperLink
Protected WithEvents lblCartStatus As System.Web.UI.WebControls. Label
Protected WithEvents DGrid As System.Web.UI.WebControls. DataGrid
Protected WithEvents HyperLink2 As System.Web.UI.WebControls. HyperLink
Protected WithEvents HyperLink3 As System.Web.UI.WebControls. HyperLink
Protected WithEvents STRONG1 As System.Web.UI.HtmlControls .HtmlGener icControl
Private Products As uc_shopping_cart
Private UserCart As New CShoppingCart
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Try
If IsPostBack Then
Else
UserCart = Session("UserCart")
Me.lblCartStatus.Text = "Shopping Cart: " & UserCart.Display(Session(" DBCon"))
LoadData(Request.QueryStri ng("catego ry"))
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub LoadData(Optional ByVal Key As Long = 0)
Try
If Key = 0 Then Key = 1
Dim DB As New System.Data.OleDb.OleDbCon nection
Dim DA As System.Data.OleDb.OleDbDat aAdapter
Dim DS As System.Data.DataSet
DB = Session("DBCon")
Dim SQL As String
SQL = "Select * From qryProducts Where CategoryID=" & Key
DA = New System.Data.OleDb.OleDbDat aAdapter(S QL, DB)
DS = New System.Data.DataSet
DA.Fill(DS)
DGrid.DataSource = DS
DGrid.DataKeyField = "ProductID"
DGrid.DataBind()
Catch ex As System.Exception
Response.Write(ex.Message)
Finally
End Try
End Sub
Private Sub DGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls. DataGridCo mmandEvent Args) Handles DGrid.ItemCommand
Try
Dim itemCell As TableCell = e.Item.Cells(0)
Dim item As String = itemCell.Text
Dim txtQuantity As TextBox = e.Item.Cells(4).Controls(1 )
Dim Quantity As String = txtQuantity.Text
If CType(e.CommandSource, LinkButton).CommandName = "AddToCart" Then
UserCart = Session("UserCart")
UserCart.Add(Quantity, item)
Response.Write("<bgsound src='images/ching.wav' id='ching' loop='1'>")
Me.lblCartStatus.Text = UserCart.Display(Session(" DBCon"))
Session("UserCart") = UserCart
End If
Catch ex As System.Exception
Response.Write(ex.Message)
End Try
End Sub
Private Sub DGrid_SelectedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DGrid.SelectedIndexChanged
End Sub
End Class
I get this error when the page pops up, some data is display but no database(Access):
Could not find file 'c:\inetpub\wwwroot\BajaSa
My Hyperlink:
<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 32px" runat="server" Font-Size="XX-Large" BorderStyle="Double" BackColor="Yellow" BorderColor="Red" Font-Names="Trebuchet MS" ForeColor="Firebrick" NavigateUrl="index.aspx" Target="_new">Customers</a
The page I'm trying to hyperlink to:
Public Class index
Inherits System.Web.UI.Page
Protected WithEvents lblCart As System.Web.UI.WebControls.
Private DTRProducts As System.Data.OleDb.OleDbDat
Private DTRCategory As System.Data.OleDb.OleDbDat
Private DB As New System.Data.OleDb.OleDbCon
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.
Protected WithEvents lblCartStatus As System.Web.UI.WebControls.
Protected WithEvents DGrid As System.Web.UI.WebControls.
Protected WithEvents HyperLink2 As System.Web.UI.WebControls.
Protected WithEvents HyperLink3 As System.Web.UI.WebControls.
Protected WithEvents STRONG1 As System.Web.UI.HtmlControls
Private Products As uc_shopping_cart
Private UserCart As New CShoppingCart
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Try
If IsPostBack Then
Else
UserCart = Session("UserCart")
Me.lblCartStatus.Text = "Shopping Cart: " & UserCart.Display(Session("
LoadData(Request.QueryStri
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub LoadData(Optional ByVal Key As Long = 0)
Try
If Key = 0 Then Key = 1
Dim DB As New System.Data.OleDb.OleDbCon
Dim DA As System.Data.OleDb.OleDbDat
Dim DS As System.Data.DataSet
DB = Session("DBCon")
Dim SQL As String
SQL = "Select * From qryProducts Where CategoryID=" & Key
DA = New System.Data.OleDb.OleDbDat
DS = New System.Data.DataSet
DA.Fill(DS)
DGrid.DataSource = DS
DGrid.DataKeyField = "ProductID"
DGrid.DataBind()
Catch ex As System.Exception
Response.Write(ex.Message)
Finally
End Try
End Sub
Private Sub DGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.
Try
Dim itemCell As TableCell = e.Item.Cells(0)
Dim item As String = itemCell.Text
Dim txtQuantity As TextBox = e.Item.Cells(4).Controls(1
Dim Quantity As String = txtQuantity.Text
If CType(e.CommandSource, LinkButton).CommandName = "AddToCart" Then
UserCart = Session("UserCart")
UserCart.Add(Quantity, item)
Response.Write("<bgsound src='images/ching.wav' id='ching' loop='1'>")
Me.lblCartStatus.Text = UserCart.Display(Session("
Session("UserCart") = UserCart
End If
Catch ex As System.Exception
Response.Write(ex.Message)
End Try
End Sub
Private Sub DGrid_SelectedIndexChanged
End Sub
End Class
I'm not sure but you can change 'c:\inetpub\wwwroot\BajaSa lsa\BajaSa lsa.mdb' to 'file://c:/inetpub/wwwroot /BajaSalsa /BajaSalsa .mdb'.
ASKER
No it didn't work, came up browse can be found:
file://c:/inetpub/wwwroot/ BajaSalsa/ BajaSalsa. mdb
file://c:/inetpub/wwwroot/
Function LoadData....
DB = Session("DBCon")
Is the DB Connection always Open ?
How are you opening your Connection, Check where are you providing the Connection String
The Error is quite obvious its not able to find the Access Database file,
DB = Session("DBCon")
Is the DB Connection always Open ?
How are you opening your Connection, Check where are you providing the Connection String
The Error is quite obvious its not able to find the Access Database file,
ASKER
No that didn't either. The database is being connected through Global.asax (only)
This is from uc_shopping_cart.ascx
Public MustInherit Class uc_shopping_cart
Inherits System.Web.UI.UserControl
Protected WithEvents Image1 As System.Web.UI.WebControls. Image
Protected WithEvents cmdSaveCart As System.Web.UI.WebControls. Button
Protected WithEvents cmdLoadCart As System.Web.UI.WebControls. Button
Protected WithEvents cmdEmptyCart As System.Web.UI.WebControls. Button
Protected WithEvents cmdCheckOut As System.Web.UI.WebControls. Button
Protected WithEvents lblCartStatus As System.Web.UI.WebControls. Label
Protected WithEvents DGrid As System.Web.UI.WebControls. DataGrid
Protected WithEvents lblCartCount As System.Web.UI.WebControls. Label
Protected WithEvents TD1 As System.Web.UI.HtmlControls .HtmlTable Cell
Private UserCart As New CShoppingCart
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack Then
DisableButtons()
Me.lblCartCount.Text = UserCart.Display(Session(" DBCon"))
Else
DisableButtons()
LoadData()
End If
End Sub
Private Sub LoadData()
Try
UserCart = Session("UserCart")
Me.lblCartCount.Text = UserCart.Display(Session(" DBCon"))
If UserCart.Count < 1 Then Me.lblCartStatus.Text = "Shopping Cart is Empty"
DGrid.DataSource = UserCart.DSCart(Session("D BCon"))
DGrid.DataBind()
Catch ex As System.Exception
End Try
End Sub
Private Sub DisableButtons()
Try
If InStr(Request.Url.ToString , "check_out") <> 0 Then
Me.cmdCheckOut.Visible = False
Me.cmdEmptyCart.Visible = False
Me.cmdLoadCart.Visible = False
Me.cmdSaveCart.Visible = False
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdSaveCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveCart.Click
Try
If Session("Customer") = 0 Then
Response.Redirect("signin. aspx?retur n=cart")
Else
UserCart = Session("UserCart")
Me.lblCartStatus.Text = UserCart.Save(Session("Cus tomer"), Session("DBCon"))
Session("UserCart") = UserCart
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdLoadCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLoadCart.Click
Try
If Session("Customer") = 0 Then
Response.Redirect("signin. aspx?retur n=cart")
Else
UserCart = Session("UserCart")
Me.lblCartStatus.Text = UserCart.Load(Session("Cus tomer"), Session("DBCon"))
Me.lblCartCount.Text = UserCart.Display(Session(" DBCon"))
Session("UserCart") = UserCart
LoadData()
Me.lblCartStatus.Text = ""
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdEmptyCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmptyCart.Click
Try
UserCart = Session("UserCart")
UserCart.DeleteSavedCart(S ession("Cu stomer"), Session("DBCon"))
UserCart.Clear()
Me.lblCartCount.Text = UserCart.Display(Session(" DBCon"))
Session("UserCart") = UserCart
LoadData()
Me.lblCartStatus.Text = ""
Catch ex As System.Exception
End Try
End Sub
Private Sub DGrid_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls. DataGridCo mmandEvent Args) Handles DGrid.EditCommand
Try
Dim itemCell As TableCell = e.Item.Cells(0)
Dim item As String = itemCell.Text
Dim txtQuantity As TextBox = e.Item.Cells(1).Controls(1 )
Dim Quantity As String = txtQuantity.Text
UserCart = Session("UserCart")
UserCart.Edit(Quantity, item)
Response.Write("<bgsound src='images/ching.wav' id='ching' loop='1'>")
Me.lblCartCount.Text = UserCart.Display(Session(" DBCon"))
Session("UserCart") = UserCart
LoadData()
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdCheckOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCheckOut.Click
Response.Redirect("check_o ut.aspx?re turn=check ")
End Sub
End Class
This is from uc_shopping_cart.ascx
Public MustInherit Class uc_shopping_cart
Inherits System.Web.UI.UserControl
Protected WithEvents Image1 As System.Web.UI.WebControls.
Protected WithEvents cmdSaveCart As System.Web.UI.WebControls.
Protected WithEvents cmdLoadCart As System.Web.UI.WebControls.
Protected WithEvents cmdEmptyCart As System.Web.UI.WebControls.
Protected WithEvents cmdCheckOut As System.Web.UI.WebControls.
Protected WithEvents lblCartStatus As System.Web.UI.WebControls.
Protected WithEvents DGrid As System.Web.UI.WebControls.
Protected WithEvents lblCartCount As System.Web.UI.WebControls.
Protected WithEvents TD1 As System.Web.UI.HtmlControls
Private UserCart As New CShoppingCart
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack Then
DisableButtons()
Me.lblCartCount.Text = UserCart.Display(Session("
Else
DisableButtons()
LoadData()
End If
End Sub
Private Sub LoadData()
Try
UserCart = Session("UserCart")
Me.lblCartCount.Text = UserCart.Display(Session("
If UserCart.Count < 1 Then Me.lblCartStatus.Text = "Shopping Cart is Empty"
DGrid.DataSource = UserCart.DSCart(Session("D
DGrid.DataBind()
Catch ex As System.Exception
End Try
End Sub
Private Sub DisableButtons()
Try
If InStr(Request.Url.ToString
Me.cmdCheckOut.Visible = False
Me.cmdEmptyCart.Visible = False
Me.cmdLoadCart.Visible = False
Me.cmdSaveCart.Visible = False
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdSaveCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveCart.Click
Try
If Session("Customer") = 0 Then
Response.Redirect("signin.
Else
UserCart = Session("UserCart")
Me.lblCartStatus.Text = UserCart.Save(Session("Cus
Session("UserCart") = UserCart
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdLoadCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLoadCart.Click
Try
If Session("Customer") = 0 Then
Response.Redirect("signin.
Else
UserCart = Session("UserCart")
Me.lblCartStatus.Text = UserCart.Load(Session("Cus
Me.lblCartCount.Text = UserCart.Display(Session("
Session("UserCart") = UserCart
LoadData()
Me.lblCartStatus.Text = ""
End If
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdEmptyCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEmptyCart.Click
Try
UserCart = Session("UserCart")
UserCart.DeleteSavedCart(S
UserCart.Clear()
Me.lblCartCount.Text = UserCart.Display(Session("
Session("UserCart") = UserCart
LoadData()
Me.lblCartStatus.Text = ""
Catch ex As System.Exception
End Try
End Sub
Private Sub DGrid_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.
Try
Dim itemCell As TableCell = e.Item.Cells(0)
Dim item As String = itemCell.Text
Dim txtQuantity As TextBox = e.Item.Cells(1).Controls(1
Dim Quantity As String = txtQuantity.Text
UserCart = Session("UserCart")
UserCart.Edit(Quantity, item)
Response.Write("<bgsound src='images/ching.wav' id='ching' loop='1'>")
Me.lblCartCount.Text = UserCart.Display(Session("
Session("UserCart") = UserCart
LoadData()
Catch ex As System.Exception
End Try
End Sub
Private Sub cmdCheckOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCheckOut.Click
Response.Redirect("check_o
End Sub
End Class
The problem lies in the code where you are opening the DB Connection
Check your Connection String, is it pointing to the MDB file properly ?
Use Relative Path and Server.MapPtah function, try to debug and see if the Path taken is right
Check your Connection String, is it pointing to the MDB file properly ?
Use Relative Path and Server.MapPtah function, try to debug and see if the Path taken is right
ASKER
Thanks for the help, I have everything working the connection is fine. My problem is I want to add a new web form and hyperlink or do I need the code somewhere to access index.aspx instead of hyperlink. I’m new to this, so I’m really sure about the coding part.
Here is my connection code for the Global.asax:
Imports System.Web
Imports System.Web.SessionState
Public Class Global
Inherits System.Web.HttpApplication
#Region " Component Designer Generated Code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
components = New System.ComponentModel.Cont ainer
End Sub
#End Region
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim UserCart As New CShoppingCart
Try
' Fires when the session is started
Session("DBCon") = DBCon()
Session("UserCart") = UserCart
Session("Customer") = 1
Catch ex As System.Exception
Finally
End Try
End Sub
Function DBCon() As System.Data.OleDb.OleDbCon nection
Try
Dim Path As String = Server.MapPath(".") & "\BajaSalsa.mdb"
'Build Connection String
Dim CString As String = "Provider=Microsoft.Jet.OL EDB.4.0; Data Source=" & _
Server.MapPath("BajaSalsa. mdb")
'Open Database
DBCon = New System.Data.OleDb.OleDbCon nection(CS tring)
DBCon.Open()
Catch
End Try
End Function
Function CloseDBCon(ByVal m_DBCon As System.Data.OleDb.OleDbCon nection) As Boolean
Try
m_DBCon.Close()
Catch
End Try
End Function
Sub Application_BeginRequest(B yVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
End Sub
Sub Application_AuthenticateRe quest(ByVa l sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Session("UserCart") = Nothing
CloseDBCon(Session("DBCon" ))
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
End Class
Here is my connection code for the Global.asax:
Imports System.Web
Imports System.Web.SessionState
Public Class Global
Inherits System.Web.HttpApplication
#Region " Component Designer Generated Code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.Debugg
components = New System.ComponentModel.Cont
End Sub
#End Region
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim UserCart As New CShoppingCart
Try
' Fires when the session is started
Session("DBCon") = DBCon()
Session("UserCart") = UserCart
Session("Customer") = 1
Catch ex As System.Exception
Finally
End Try
End Sub
Function DBCon() As System.Data.OleDb.OleDbCon
Try
Dim Path As String = Server.MapPath(".") & "\BajaSalsa.mdb"
'Build Connection String
Dim CString As String = "Provider=Microsoft.Jet.OL
Server.MapPath("BajaSalsa.
'Open Database
DBCon = New System.Data.OleDb.OleDbCon
DBCon.Open()
Catch
End Try
End Function
Function CloseDBCon(ByVal m_DBCon As System.Data.OleDb.OleDbCon
Try
m_DBCon.Close()
Catch
End Try
End Function
Sub Application_BeginRequest(B
' Fires at the beginning of each request
End Sub
Sub Application_AuthenticateRe
' Fires upon attempting to authenticate the use
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Session("UserCart") = Nothing
CloseDBCon(Session("DBCon"
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm not an expert, but if I understand correctly - try to link to another location on the index page. Is it possible to link to one of the HTML codes in the Index.aspx?
Index.aspx (HTML)
%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb" Inherits="BajaSalsa.index" %>
>
<title>BajaSalsa Shopping Cart</title>
<asp:hyperlink id="HyperLink2" runat="server" NavigateUrl="index.aspx?ca tegory=1"> Salsa Original Chunky</asp:hyperlink></P>
<asp:hyperlink id="HyperLink3" runat="server" NavigateUrl="index.aspx?ca tegory=2"> Salsa Fire Roasted</asp:hyperlink></P >
Index.aspx (HTML)
%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb"
>
<title>BajaSalsa Shopping Cart</title>
<asp:hyperlink id="HyperLink2" runat="server" NavigateUrl="index.aspx?ca
<asp:hyperlink id="HyperLink3" runat="server" NavigateUrl="index.aspx?ca
When you link to index.aspx?category=1
all it will do is go to the Index.aspx page and pass it a QueryString called Category with value 1
So in your code say on Page_Load you should do whatever you want to do with this QueryString
In case you want that the hyperlink should directly take you to a section of your page, say for eg Index.aspx page is a very long page and you want that the Hyperlink should take you to the bottom of the page directly (this is waht I gather from "try to link to another location on the index page") then that's fairly possible
put <A HREF="#MyLocation"></a> this code at the place in the page where you want to be then in the Hyperlink controls NavigateUrl property say this "index.aspx#MyLocation"
Hope that's what you wanted
all it will do is go to the Index.aspx page and pass it a QueryString called Category with value 1
So in your code say on Page_Load you should do whatever you want to do with this QueryString
In case you want that the hyperlink should directly take you to a section of your page, say for eg Index.aspx page is a very long page and you want that the Hyperlink should take you to the bottom of the page directly (this is waht I gather from "try to link to another location on the index page") then that's fairly possible
put <A HREF="#MyLocation"></a> this code at the place in the page where you want to be then in the Hyperlink controls NavigateUrl property say this "index.aspx#MyLocation"
Hope that's what you wanted