Hi,

I am new to ASP.NET, working on a web app using Visual Studio and VB. My App was working fine before and after I made few changes, It opens "Default.aspx" for any selection. I've even remaned the file "default.aspx" in the solution to something else and made sure there is no reference to "default.aspx" page in my code, it still looks for it and app fails with error that "default.aspx" not found. I am very frustated, please help !! :confused:

thanks in advance.
T

Which version of VS are you using? Is the app hosted in IIS? Have you made changes there? What "Changes" did you make just before it stopped working?

Something is set in VS i think to make it start up looking for default.aspx but need to know which VS you are using first

Which version of VS are you using? Is the app hosted in IIS? Have you made changes there? What "Changes" did you make just before it stopped working?

Something is set in VS i think to make it start up looking for default.aspx but need to know which VS you are using first

Thanks for the reply. I am using VS 2003 Ver 7.1.3088 and I did not change anything in IIS settings.
Attaching my code.
the app starts with page "Home.aspx" and from there it opens "login.aspx" where depending on the login and role of the person it should open perticular page, which was working fine, now it is looking for "default.aspx" always. the chnage I made was just to add "Session("Homepage_selection") super cookie in there.

webconfig
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<system.web>

<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage="vb" debug="true" />

<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.

"On" Always display custom (friendly) messages.
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors mode="RemoteOnly" />

<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"

"None" No authentication is performed.
"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
its settings for the application. Anonymous access must be disabled in IIS.
"Forms" You provide a custom form (Web page) for users to enter their credentials, and then
you authenticate them in your application. A user credential token is stored in a cookie.
"Passport" Authentication is performed via a centralized authentication service provided
by Microsoft that offers a single logon and core profile services for member sites.

<authentication mode="Windows" />
-->
<authentication mode="Windows">
</authentication>

<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->

<authorization>
<deny users ="?" />
<allow users = "*" />
</authorization>


<!-- Allow all users -->
<!-- <allow users="*" /> -->


<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->


<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />


<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>

<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

</system.web>

</configuration>

Home.aspx.vb
Public Class WebForm8
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents CoachActivity As System.Web.UI.WebControls.Label
Protected WithEvents GLC As System.Web.UI.WebControls.Label
Protected WithEvents LinkButton_Colleagues As System.Web.UI.WebControls.LinkButton
Protected WithEvents LinkButton_Managers As System.Web.UI.WebControls.LinkButton
Protected WithEvents LinkButton_Coaches As System.Web.UI.WebControls.LinkButton
Protected WithEvents LinkButton_Admin As System.Web.UI.WebControls.LinkButton
Protected WithEvents TopLine As System.Web.UI.WebControls.Label
Protected WithEvents BottomLine As System.Web.UI.WebControls.Label
Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

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
End Sub

Private Sub LinkButton_Colleagues_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton_Colleagues.Click
Session("HomePage_Selection") = "Colleague" ' colleague
Response.Redirect("Login.aspx")
End Sub

Private Sub LinkButton_Managers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton_Managers.Click
Session("HomePage_Selection") = "Manager" 'Manager
Response.Redirect("Login.aspx")

End Sub

Private Sub LinkButton_Coaches_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton_Coaches.Click
Session("HomePage_Selection") = "Coach" 'Coach
Response.Redirect("Login.aspx")

End Sub

Private Sub LinkButton_Admin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton_Admin.Click
Session("HomePage_Selection") = "Admin" 'Administrator
Response.Redirect("Login.aspx")

End Sub

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Session("HomePage_Selection") = "Guest" 'Guest
Response.Redirect("Login.aspx")
End Sub
End Class

Login.aspx.vb
Imports System.Data.SqlClient
Imports System.Web.Security

Public Class Login_form
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents GLC As System.Web.UI.WebControls.Label
Protected WithEvents CoachLoginForm As System.Web.UI.WebControls.Label
Protected WithEvents PlEnter As System.Web.UI.WebControls.Label
Protected WithEvents Username As System.Web.UI.WebControls.Label
Protected WithEvents Password As System.Web.UI.WebControls.Label
Protected WithEvents BottomLine As System.Web.UI.WebControls.Label
Protected WithEvents Coach_Pass As System.Web.UI.WebControls.TextBox
Protected WithEvents Error_Message As System.Web.UI.WebControls.Label
Protected WithEvents cmdSubmit As System.Web.UI.WebControls.Button
Protected WithEvents UserId As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents LinkBtn_Guest As System.Web.UI.WebControls.LinkButton
Protected WithEvents LinkBtn_Register As System.Web.UI.WebControls.LinkButton
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents TopLine As System.Web.UI.WebControls.Label
Protected WithEvents Btn_Back As System.Web.UI.WebControls.Button

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

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
'Error_Message.Text = "I am here"
End Sub

Private Function ValidateUser(ByVal userName As String, ByVal passWord As String) As String
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim returnUser_role As String

returnUser_role = Nothing

Error_Message.Text = "I am in the function"

Try
Error_Message.Text = "I am here 1"
conn = New SqlConnection("server=localhost;Integrated Security=SSPI;database=Coaching")
conn.Open()
cmd = New SqlCommand("Select Role_Key from Logins where login=@userName and passwd=@passWord", conn)

cmd.Parameters.Add("@userName", SqlDbType.Char, 50)
cmd.Parameters("@userName").Value = userName
cmd.Parameters.Add("@passWord", SqlDbType.Char, 50)
cmd.Parameters("@passWord").Value = passWord

returnUser_role = cmd.ExecuteScalar()

cmd.Dispose()
conn.Dispose()

If (returnUser_role Is Nothing) Then
returnUser_role = "invalid"
Return returnUser_role
End If

If (Session("HomePage_Selection") <> returnUser_role) Then
returnUser_role = "Invalid"
Error_Message.Text = "For the Selected Role"
Return returnUser_role
End If

'Error_Message.Text = "For the Selected Role" & returnUser_role

Return returnUser_role

Catch ex As Exception
System.Diagnostics.Trace.WriteLine("[ValidateUser] Exception " & ex.Message)
End Try

End Function
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
Dim Coach_role As String

Coach_role = Nothing
Error_Message.Text = "I am in the Sub this -->" & Coach_role

If Page.IsValid Then
Coach_role = (ValidateUser(UserId.Text.Trim(), Coach_Pass.Text.Trim())).Trim
Error_Message.Text = "I am this -->" & Coach_role

FormsAuthentication.RedirectFromLoginPage(UserId.Text, False)


If (Coach_role = "Invalid") Then
Error_Message.Text = "Err : Invalid Username / Password" & Error_Message.Text
If CInt(Session("Num_of_Tries")) > 2 Then
Response.Redirect("Denied.aspx")
End If
ElseIf (Coach_role = "Colleague") Then
Response.Redirect("TL_SelectionPage.aspx")
ElseIf (Coach_role = "Manager") Then
Response.Redirect("TL_SelectionPage.aspx")
ElseIf (Coach_role = "Coach") Then
Response.Redirect("Add_Coach.aspx")
ElseIf (Coach_role = "Admin") Then
'Response.Redirect("Admin_SelectionPage.aspx")
ElseIf (Coach_role = "Guest") Then
Response.Redirect("CoachFinder.aspx")
Else
Error_Message.Text = "Err : Invalid Username / Password" & Error_Message.Text
End If


End If
End Sub

Private Sub Btn_Back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Back.Click
Response.Redirect("Home.aspx")
End Sub

Private Sub LinkBtn_Guest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkBtn_Guest.Click
If Page.IsValid Then
UserId.Text = "Guest"
Coach_Pass.Text = "Guest"

FormsAuthentication.RedirectFromLoginPage(UserId.Text, False)
Response.Redirect("CoachFinder.aspx")
End If
End Sub

Private Sub LinkBtn_Register_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkBtn_Register.Click

End Sub
End Class
==========================

thanks again.
T :!:

I have a feeling that something has set iis to look for default.aspx as the start page, or vs has been told to do the same. Did you have a default.aspx in there at one time? in your solution explorer right click on your home.aspx and click on set as start page. That will make sure that vs is correct. if you just opened a web browser and typed in the path there does it still happen? (I assume you have tried this).
Couple of other pointers outside of this. why are you using windows authentication and then implementing a login box and roles in a sql database? that usually implies forms authentication. Also, my vb is rusty at best and it may be more forgiving than c# but in c# you have to cast anything from the session before using it, otherwise it is just an object type and your <> wouldnt work.

This article has been dead for over six months. Start a new discussion instead.