Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2003, 09:38 AM
Authorized User
 
Join Date: Sep 2003
Location: Cambridge, , United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Authentication in ASP .NET (VB)

I am wondering if anyone can help me.

I have designed a dynamic website using asp .NET and need to create a login for a secure area to access a database (MSDE) I have got the thing to work locally (IE On the machine the website is stored) but when I try to test it out over my LAN, I can seem to get access to the secure data.

Below is the web.config code:
<configuration>

    <appSettings>

    </appSettings>

<system.web>
        <customErrors mode="Off" />
            <authentication mode="Forms">

                    <forms name=".ASPXAUTH"
                           loginUrl="login.aspx"
                           protection="Validation"
                           timeout="999999" />

             </authentication>




        <!--

            The <authorization> section enables developers/administrators to configure
            whether a user or role has access to a particular page or resource. This is
            accomplished by adding "<allow>" and "<deny>" sub-tags beneath the <authorization>
            section - specifically detailing the users/roles allowed or denied access.

            Note: The "?" character indicates "anonymous" users (ie: non authenticated users).
            The "*" character indicates "all" users.
        -->
            <authorization>
               <deny users="?" />
            </authorization>

    </system.web>
</configuration>

And below is the code for login.aspx

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,culture=neutral" %>
<%@ Import Namespace="System.Web.Security"%>
<MM:DataSet
id="DataSet1"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_Test") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETYPE_Test") %>'
CommandText='<%# "SELECT * FROM dbo.USERS WHERE userName = @userName and password = @password" %>'
Expression='<%# IsPostBack %>'
Debug="true"
><Parameters>
  <Parameter Name="@userName" Value='<%# IIf((Request.Form("txt_user") <> Nothing), Request.Form("txt_user"), "") %>' Type="NVarChar" />
  <Parameter Name="@password" Value='<%# IIf((Request.Form("UserPass") <> Nothing), Request.Form("UserPass"), "") %>' Type="NVarChar" />
</Parameters></MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<Script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If Not IsPostBack Then
 Validate()
End If
End Sub

</Script>
<html>
<head>
<title>Login page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
  if DataSet1.recordcount > 0 then
    FormsAuthentication.RedirectFromLoginPage(txt_User .Text,true)
  else if ((Request.Form("UserPass"))) <> Nothing OR ((Request.Form("txt_user"))) <> Nothing
    response.Write("Login failed. Please try again.")
  end if
%>

rest of page here

Can anyone offer any suggestions?

Thanks in advance

---
David Thorne, Student
UK
__________________
---
David Thorne, Student
UK
 
Old September 25th, 2003, 07:17 PM
Registered User
Points: 25, Level: 1
Points: 25, Level: 1 Points: 25, Level: 1 Points: 25, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sstory
Default

Can you access any pages? (unsecure ones)? or are they all protected?

Is this webconfig in the root or a special subdirectory?

Are their multiple sites on this one webserver?

Shane




Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Authorisation / Authentication robzyc ASP.NET 2.0 Basics 6 April 25th, 2008 09:20 AM
Proxy Authentication Required in ASP.Net appln. rajbiswas76 General .NET 2 March 2nd, 2007 09:12 AM
How windows NET authentication done in ASP pages lakshmy_raj Classic ASP Basics 1 October 20th, 2004 02:28 AM
Authentication in ASPX(VB .NET) CFerthorney ASP.NET 1.0 and 1.1 Professional 5 September 9th, 2003 10:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.