• 大小: 8.95MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-07
  • 语言: C#
  • 标签: ASP.NET  MVC3  源码  

资源简介

ASP.NET MVC3 英文资料 ASP.NET MVC3 实例 ASP.NET MVC3 源码

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using Mvc3ToolsUpdateWeb_Default.Models;

namespace Mvc3ToolsUpdateWeb_Default.Controllers
{
    public class AccountController : Controller
    {

        //
        // GET: /Account/LogOn

        public ActionResult LogOn()
        {
            return View();
        }

        //
        // POST: /Account/LogOn

        [HttpPost]
        public ActionResult LogOn(LogOnModel model string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (Membership.ValidateUser(model.UserName model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.UserName model.RememberMe);
                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith(“/“)
                        && !returnUrl.StartsWith(“//“) && !returnUrl.StartsWith(“/\\“))
                    {
                        return Redirect(returnUrl);
                    }
                    else
                    {
                        return RedirectToAction(“Index“ “Home“);
                    }
                }
                else
                {
                    ModelState.AddModelError(““ “The user name or password provided is incorrect.“);
                }
            }

            // If we got this far something failed redisplay form
            return View(model);
        }

        //
        // GET: /Account/LogOff

        public ActionResult LogOff()
        {
            FormsAuthentication.SignOut();

            return RedirectToAction(“Index“ “Home“);
        }

        //
        // GET: /Account/Register

        public ActionResult Register()
        {
            return View();
        }

        //
        // POST: /Account/Register

        [HttpPost]
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName model.Password model.Email “question“ “answer“ true null out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName false /* createPersistentCookie */);
                    return RedirectToAction(“Index“ “Home“);
                }
                else
                {
                    ModelState.AddModelError(““ ErrorCodeToString(createStatus));
                }
            }

            // If we got this far something failed redisplay form
            return View(model);
        }

        //
        // GET: /Account/ChangePassword

        [Authori

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\
     文件     4993295  2011-04-29 09:09  MvcMusicStore-v3.0\MVC Music Store - Tutorial - v3.0.pdf
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Controllers\
     文件        6818  2011-04-13 05:48  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Controllers\AccountController.cs
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Models\
     文件        2145  2011-04-13 05:25  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Models\AccountModels.cs
     文件       66929  2011-04-12 21:31  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Models\SampleData.cs
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Views\
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Views\Account\
     文件        1787  2011-04-13 05:25  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Views\Account\ChangePassword.cshtml
     文件         139  2011-04-13 05:25  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Views\Account\ChangePasswordSuccess.cshtml
     文件        1528  2011-04-13 05:25  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Views\Account\LogOn.cshtml
     文件        2024  2011-04-13 05:25  MvcMusicStore-v3.0\MvcMusicStore-Assets\Code\Views\Account\Register.cshtml
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Content\
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Content\Images\
     文件      254130  2010-07-31 04:54  MvcMusicStore-v3.0\MvcMusicStore-Assets\Content\Images\home-showcase.png
     文件        2963  2010-08-03 04:04  MvcMusicStore-v3.0\MvcMusicStore-Assets\Content\Images\logo.png
     文件        1556  2010-07-31 04:54  MvcMusicStore-v3.0\MvcMusicStore-Assets\Content\Images\placeholder.gif
     文件        4219  2011-04-13 21:25  MvcMusicStore-v3.0\MvcMusicStore-Assets\Content\Site.css
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Assets\Data\
     文件    10485760  2010-08-13 05:38  MvcMusicStore-v3.0\MvcMusicStore-Assets\Data\ASPNETDB.MDF
     文件      148200  2010-08-13 05:40  MvcMusicStore-v3.0\MvcMusicStore-Assets\Data\MvcMusicStore-Create.sql
     文件     4194304  2010-08-13 05:38  MvcMusicStore-v3.0\MvcMusicStore-Assets\Data\MvcMusicStore.mdf
     文件     2883584  2010-08-13 05:38  MvcMusicStore-v3.0\MvcMusicStore-Assets\Data\MvcMusicStore_log.ldf
     文件      516096  2010-08-13 05:38  MvcMusicStore-v3.0\MvcMusicStore-Assets\Data\aspnetdb_log.ldf
     文件         507  2011-04-13 21:40  MvcMusicStore-v3.0\MvcMusicStore-Assets\readme.txt
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Completed\
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Completed\MvcMusicStore\
     目录           0  2011-11-16 08:23  MvcMusicStore-v3.0\MvcMusicStore-Completed\MvcMusicStore\App_Data\
............此处省略205个文件信息

评论

共有 条评论