4 Replies - 2056 Views - Last Post: 03 April 2017 - 03:28 AM Rate Topic: -----

#1 Seyar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-October 16

ASP.NET Login and Log out with Session

Posted 04 February 2017 - 11:24 AM

Hi,

I am developing a website in ASP.Net which has 3 pages:
-Search.aspx - Allows user to search.
-SearchResult.aspx - Displays the search result.
-Users.aspx - Allows logged in users to manage their content.

I am not using a master page because these 3 pages have different layouts.

This is an screenshot of the "Sign In" dialog (Boostrap Modal).
Posted Image

And here is the code for that:

 <form role="form">
      <div class="form-group">
          <input type="email" class="form-control" id="email" placeholder="Enter email" />
          <br />
        <input type="password" class="form-control" id="password" placeholder="Enter password" />
                                </div>
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" />
                                        <span style="color: black;">Remember me</span>
                                    </label>
                                </div>
                                <button type="submit" class="btn btn-default">Sign in</button>
                                <br />
                                <a href="#"><span style="color: black; float: right">Forgot password?</span></a>
                            </form>



I use SQL Server as a database in which the "Users" table has the email and password column for the user to login.

What would be the proper and secure way to login the user in the system and manage his/her session?
Also, how to make the Users.aspx to be only accessible once the user is logged in?

I would appreciate to receive a bit detailed info on this with some bit of code, because I am new with user login and session thing.


Thanks,

Wrong forum - Any admin/moderator can move it to appropriate forum please?

Is This A Good Question/Topic? 0
  • +

Replies To: ASP.NET Login and Log out with Session

#2 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,770
  • Joined: 12-December 12

Re: ASP.NET Login and Log out with Session

Posted 04 February 2017 - 11:30 AM

You need to find and study tutorials for these important subjects, this is not something that can be answered in one or two forum posts.

Presumably you are reading a book or studying tutorials already? If they don't cover the material then you need to find others.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,770
  • Joined: 12-December 12

Re: ASP.NET Login and Log out with Session

Posted 04 February 2017 - 11:36 AM

Moved to ASP.NET forum.

(There is a "Forums" button at the top left which lists all of the forums.)
Was This Post Helpful? 0
  • +
  • -

#4 Seyar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-October 16

Re: ASP.NET Login and Log out with Session

Posted 04 February 2017 - 11:43 AM

Yea, I do already study a book "Beginning ASP.NET 4 in C# and VB" along with tutorials on MVA and Pluralsight.
Most of them are about Login, LoginView and LoginStatus controls in ASP.NET.
So, I wanted to know how I could implement that in my own login dialog (modal).
Was This Post Helpful? 0
  • +
  • -

#5 Sam Hobbs  Icon User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 50
  • Joined: 01-April 17

Re: ASP.NET Login and Log out with Session

Posted 03 April 2017 - 03:28 AM

First find a host that supports Web Deploy. Microsoft Azure does of course and it is difficult to find any others that are good that does support Web Deploy. GoDaddy does not, at least not for shared hosting. Web Deploy is better than deploying by FTP since Web Deploy takes care of the database and other things that FTP does not do.

In parallel with finding a good host, install IIS locally in your system if you have not already done so. Then go to Visual Studio and select "File" | "New" | "Web Site..." and in the "New Web Site" window choose "ASP.NET Web Forms Site". When you create a web site that way then it will create a site with a database and forms for memberships, including a way to register and a way to login when someone has registered. You might migrate your existing site into the generated site but at least you will have an example of how to do things. Don't ask me how to deploy it and things like that, I have not yet moved to somewhere else from GoDaddy. I forget the details of what happens if you don't have IIS installed and running before creating your web site but if IIS is not available then VS will use its development server and that does not work very well but I forget the details of the problems I had. I think maybe the main problem is that VS selects a port for use in testing and if there is a problem with the port then it is difficult or impossible to fix.

To create web sites in VS do not do "File" | "New" | "Project..." (the older way to create a site) unless you understand the difference in the two ways to create a web site and you know you want to use the older way. You don't need to change what you have just for that but this is just for the future.

Another option is to use a CMS. DNN (formerly DotNetNuke) is popular. There is also Orchard; it is newer but I think Microsoft is participating in its development.

This post has been edited by Sam Hobbs: 03 April 2017 - 03:35 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1