How to enable basic authentication before the processing the request in asp.mvc? (Description inside)

<>

This question already has an answer here:

Answers


here give u demo which is define about authenticate of client

here is about controller code

   [HttpPost]
   public ActionResult LogOn(LogOnModel model, string returnUrl)
    {
        if (ModelState.IsValid)
        {
            var userInfo = new UserInfo
            {
                UserName = model.UserName,
                Password = model.Password,
                //AppType = "Web"
            };

            var service = new ATWMSService();
            if(service.ValidateUser(userInfo))
            {
                Session["UserId"] = service.GetUserId(userInfo.UserName);
                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                    && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return Redirect(returnUrl);
                }
                return Redirect("~/");
            }
            ModelState.AddModelError("","The user name or password provided is incorrect.");
        }

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

Need Your Help

Copying lines from stdin to an array of character pointers

c arrays pointers

I would like to copy lines from stdin to an array of character pointers. For example if the user entered the following "the\nquick\nbrown\nfox" then I would like to have an array that looks like

AngularJS - pass parameter from ng-repeat to controller from custom directive

angularjs angularjs-directive angularjs-ng-repeat

I have a custom AngularJS directive, which is rendering a ng-repeat. In this ng-repeat I want to pass one element to a function. The function is called, but item is undefined.