Click here to Skip to main content
15,911,132 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: mail sending problem in asp.net + c# Pin
tech60320-Mar-09 17:29
tech60320-Mar-09 17:29 
Questionproblem with session Pin
prasadbuddhika19-Mar-09 18:25
prasadbuddhika19-Mar-09 18:25 
AnswerRe: problem with session Pin
Christian Graus19-Mar-09 18:28
protectorChristian Graus19-Mar-09 18:28 
AnswerRe: problem with session Pin
Abhijit Jana19-Mar-09 18:40
professionalAbhijit Jana19-Mar-09 18:40 
GeneralRe: problem with session Pin
prasadbuddhika19-Mar-09 19:03
prasadbuddhika19-Mar-09 19:03 
GeneralRe: problem with session Pin
Abhijit Jana19-Mar-09 19:10
professionalAbhijit Jana19-Mar-09 19:10 
GeneralRe: problem with session Pin
prasadbuddhika19-Mar-09 19:20
prasadbuddhika19-Mar-09 19:20 
QuestionHTML Login Controls help! Pin
Necron819-Mar-09 14:11
Necron819-Mar-09 14:11 
Hello there people I'm working on an ASP.NET website using C# code on VS 2005. My problem is that when using the Login controls like the Registration Form, Login Control, Login Status, Change Password, etc, I don't want the project to create a .mdf file. So, I made a connection string in the web.config file to use my SQL Server 2005 database. The problem is how could I make this kind of registration type of site? I've tried searching tutorials but with no success. I want the site to be able to handle registrations and logins using my SQL Server 2005 database

Website type is: Shopping Cart.

Problems I'm encountering:
1. I need to know how to use login controls using an SQL Database which is not created automatically.
2. I need to know hot to tackle permissions, like I have the main site to be available to non-registered users and registered users but I don't want anyone to access the Administration site.

File Structure:
Folder -> Administration
Admin.aspx
UserList.aspx
Folder -> App_Code (to store the code of the cart/other functions
Code.aspx
Folder -> App_Data (not used because I want to use an external Database)
Folder -> App_Themes (to store stylesheets)
Folder -> Images to store all the images
Folder -> Catalog (contains the products cathegories)
Folder -> Login
Login.aspx
Register.aspx
ChangePW.aspx
RecoverPW.aspx
RecoverPWConfirmation.aspx

Default.aspx
MasterPage.master
Admin.master

I'm Using two master pages, one for the whole site, and one for the administration.

I want to use the main login with a hard coded admin privileged user in the database to access the administration and no-one else.
My DB has a table named user Permission where it has the PermissionID(PK)(1, 2), PermissionType(User/Admin) and have a table named Clients with the Client ID(PK), Name, Surname, PermissionID(FK)

So far this is the code I used for the Web.Config File
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

  <system.net>
    <mailsettings>
      <smtp deliverymethod="PickupDirectoryFromIis" from="Admin@ImagineComputers.com">
      </smtp>
    </mailsettings>
  </system.net>
  
  <appsettings />
	<connectionstrings />
	<system.web>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
		<compilation debug="true" />

		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    
		<rolemanager enabled="true" />
		<!--
			Role manager is used so that users can have certain 
			privelages and Administrators have all privelages
		-->    
		<authentication mode="Windows" />
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
	</system.web>

    
  <!--
        Mail settings used for online server
        -->	
		<!--<mailSettings>
			<smtp>
				<network host="my.mail.server" />
			</smtp>
		</mailSettings>-->
  
</configuration>


And this is the code of the master page:

<![CDATA[<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>]]>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="App_Themes/StyleSheet.css" rel="stylesheet" type="text/css" />
    <title>Test Computers</title>
</head>
<body>
    <form id="form1" runat="server">
        <center>
            <div id="topContent">
                <table id="topTable" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>
                             <br />
                            <br />
                        </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                    <tr>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                        <td>
                             </td>
                    </tr>
                </table>
            </div>
        </center>
        <center>
            <table id="mainContent" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td id="leftContent">
                         </td>
                    <td id="middleContent">
                        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server" xmlns:asp="#unknown">
                        </asp:contentplaceholder>
                    </td>
                    <td id="rightContent">
                        <asp:loginname id="LoginName1" runat="server" style="position: static" xmlns:asp="#unknown" />
                        <asp:loginview id="LoginView1" runat="server" xmlns:asp="#unknown">
                            <rolegroups>
                                <asp:rolegroup roles="Admin">
                                    <contenttemplate>
                                        <a href="Administrator/Administration.aspx">Admin Page</a>
                                    </contenttemplate>
                                </asp:rolegroup>
                            </rolegroups>
                        </asp:loginview>
                        <asp:loginstatus id="LoginStatus1" runat="server" style="position: static" xmlns:asp="#unknown" />
                        <br />
                        <br />
                        <img src="Images/Site/cart.jpg" alt="Cart" style="float: left;" id="imgCart" />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        Items:
                        <br />
                        Price:</td>
                </tr>
            </table>
        </center>
        <center>
            <div id="bottomContent">
            </div>
        </center>
    </form>
</body>
</html>


I hope this long question is not too bad for someone to help me. I thank you beforehand!

Regards,
Francesco (Junior Programmer :] anxious to learn)
AnswerRe: HTML Login Controls help! Pin
Stein The Ruler19-Mar-09 16:11
Stein The Ruler19-Mar-09 16:11 
GeneralRe: HTML Login Controls help! Pin
Necron820-Mar-09 1:06
Necron820-Mar-09 1:06 
AnswerRe: HTML Login Controls help! Pin
Abhijit Jana19-Mar-09 18:43
professionalAbhijit Jana19-Mar-09 18:43 
AnswerRe: HTML Login Controls help! Pin
tech60320-Mar-09 17:39
tech60320-Mar-09 17:39 
QuestionImage.FromStream - Parameter is not valid. HELP! Pin
Stein The Ruler19-Mar-09 13:00
Stein The Ruler19-Mar-09 13:00 
AnswerRe: Image.FromStream - Parameter is not valid. HELP! Pin
Christian Graus19-Mar-09 13:16
protectorChristian Graus19-Mar-09 13:16 
GeneralRe: Image.FromStream - Parameter is not valid. HELP! Pin
Stein The Ruler19-Mar-09 14:01
Stein The Ruler19-Mar-09 14:01 
GeneralRe: Image.FromStream - Parameter is not valid. HELP! Pin
Christian Graus19-Mar-09 15:53
protectorChristian Graus19-Mar-09 15:53 
GeneralRe: Image.FromStream - Parameter is not valid. HELP! Pin
Stein The Ruler19-Mar-09 16:30
Stein The Ruler19-Mar-09 16:30 
GeneralRe: Image.FromStream - Parameter is not valid. HELP! Pin
Christian Graus19-Mar-09 17:08
protectorChristian Graus19-Mar-09 17:08 
QuestionCompareValidator firing server side on date input [modified] Pin
DanB198319-Mar-09 12:32
DanB198319-Mar-09 12:32 
AnswerRe: CompareValidator firing server side on date input Pin
DanB198320-Mar-09 2:33
DanB198320-Mar-09 2:33 
QuestionProblem with image transparent background Pin
StuffyEst19-Mar-09 9:25
StuffyEst19-Mar-09 9:25 
AnswerRe: Problem with image transparent background Pin
Christian Graus19-Mar-09 9:55
protectorChristian Graus19-Mar-09 9:55 
GeneralRe: Problem with image transparent background Pin
StuffyEst19-Mar-09 9:58
StuffyEst19-Mar-09 9:58 
QuestionDrag and Drop images using .net and flash Pin
dotnetlover_1119-Mar-09 8:06
dotnetlover_1119-Mar-09 8:06 
AnswerRe: Drag and Drop images using .net and flash Pin
Christian Graus19-Mar-09 9:53
protectorChristian Graus19-Mar-09 9:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.