everyone. I've developed the website with asp.net 4.0 and deployed the in the IIS 7.5. I want to add some https for the certain web aspx page. For example, for the login, the site uses login.aspx. When the user browsing that page, I want to add the https for login.aspx. How can I do? Thanks.

sorry about my bad english, i'm learning Typescript and Angular, and i'm trying to upload a file into my database but the code in the server side and client is in Javascript and i dont know how to transform the code to Typescript, could you guys help me? This is the code:

app.controller('MyCtrl',function($scope){
    $scope.$watch('files.length',function(newVal,oldVal){
        console.log($scope.files);
    });
});

 app.controller('MyCtrl',function($scope){

    ...

    $scope.onSubmit = function(){
        var formData = new FormData();
        angular.forEach($scope.files,function(obj){
            formData.append('files[]', obj.lfFile);
        });
        $http.post('./upload', formData, {
            transformRequest: angular.identity,
            headers: {'Content-Type': undefined}
        }).then(function(result){                  
        },function(err){
        });
    };

    ...

});
var express = require('express');
var formidable = require('formidable');
var app = express();
app.use(express.static(__dirname + '/public'));

...

app.post('/upload',function(req,res){
    var form = new formidable.IncomingForm();
    form.uploadDir = __dirname +'/public/uploads';
    form.parse(req, function(err, fields, files) {
    });
    form.on ('fileBegin', function(name, file){
        file.path = form.uploadDir + "/" + file.name;
    });
    form.on ('end', function(){
        res.sendStatus(200);   
    });
});

...
var express = require('express');
var multer = require('multer');
var app = express();
app.use(express.static(__dirname + '/public'));

...

var storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, __dirname +'/public/uploads');
        //modify upload dest
    },
    filename: function (req, file, cb) {
        cb(null, file.originalname);
    }
});
var upload = multer({ "storage": storage });
var type = upload.array('files[]');

app.post('/upload',type,function(req,res){
    res.sendStatus(200);
});

...

This question already has an answer here:

In my logging page if i give correct username and password then it works good but if i give wrong username and password then it shows Object reference not set to an instance of an object I understood why it said this but could not get answer though i try many way. My LoginButton code is given bellow :

     protected void loginButton_Click(object sender, EventArgs e)
       {            
        Admin aAdmin = new Admin();
        aAdmin.AdminName = userNameTextBox.Text;
        aAdmin.AdminPassword = userPasswordTextBox.Text;
         //AdminManager is for show message
        AdminManager aAdminManager= new AdminManager();
         //Call function aAdminManager.GetAdmin(aAdmin)
        messageLabel.Text= aAdminManager.GetAdmin(aAdmin);
        Session["UserName"] = aAdmin.AdminName;
        Response.Redirect("Index.aspx");
      }

AdminManager.cs

public class AdminManager
{

    AdminGateway aAdminGateway=new AdminGateway();
    public string GetAdmin(Admin aAdmin)
    {
        // call function aAdminGateway.GetAdmin(aAdmin) for SQL Query
       int rowAffected= aAdminGateway.GetAdmin(aAdmin);
       if (rowAffected == 1)
        {

        }
        else
       {
           return "UserName or Password Wrong!";
       }
        return "";
    }
}

AdminGateway.cs

public int GetAdmin(Admin aAdmin)
    {
        Query = "SELECT * FROM Admin WHERE UserName='" + aAdmin.AdminName + "'AND Password='" + aAdmin.AdminPassword +
                "'";
        Command = new SqlCommand(Query, Connection);
        Connection.Open();
        int rowAffected = Convert.ToInt32(Command.ExecuteScalar().ToString());//this line give exception
        Reader.Close();
        Connection.Close();
        return rowAffected;
    }

I want after checking QUERY if any row doesn't affected then it back to AdminManager.cs and my message are in this code and return AdminLoggin.aspx.cs then show message that username and/or password error. How to solve this exception and show message for wrong username and password.

I cant see the dropdown list I created (click this link for image)

Here is my code in add.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

//ADO.NET
using System.Data;
using System.Data.SqlClient;
using System.IO;

public partial class Admin_Users_Add : System.Web.UI.Page
{
      SqlConnection con = new SqlConnection(kmb.GetConnection());
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetCategoryTypes();
        }
    }
    /// <summary>
    /// Allows the user to display list of user types
    /// from the table Types to the dropdownlist control
    /// </summary>
    void GetCategoryTypes()
    {


            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "SELECT CatID, Category FROM Categories";
            SqlDataReader dr = cmd.ExecuteReader();
            ddlCategoryTypes.DataSource = dr;
            ddlCategoryTypes.DataTextField = "Category";
            ddlCategoryTypes.DataValueField = "CatID";
            ddlCategoryTypes.DataBind();

            ddlCategoryTypes.Items.Insert(0, new ListItem("Select one...", ""));
            con.Close();

In database I created 2 tables:

Categories(CatID [PK], Category[FK])

CategoryTypes(Category [PK], Appetizers, Desserts, Beverages)

---- I want to see the "Appetizers, Desserts, Beverages" in the dropdown list which is from database, in my webpage

enter image description here is this possible to do dividing the series. Full of one series one side and another series is one side same as the image by using charts can anyone tell me please how to do this. Thank you

I am creating an online examination system and in admin panel i am creating the create exam event. I created a from for launch the exam. I want after click on launch button exam details should be submit in database which is easy but i also want the form created for launching the exam should be also replaced with form for adding question for that exam.

Anybody has idea...plzz help me

Im following this tutorial. I Create my WebApi and works Ok from the browser. But when try to add it as web reference tell me this error.

The document at the url http://localhost/WebApi/api/test was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'. - Report from 'DISCO Document' is 'Data

TestController

namespace WebApi.Controllers
{
    public class TestController : ApiController
    {
        public HttpResponseMessage Get()
        {
            return new HttpResponseMessage()
            {
                Content = new StringContent("GET: Test message")
            };
        }

        public HttpResponseMessage Post()
        {
            return new HttpResponseMessage()
            {
                Content = new StringContent("POST: Test message")
            };
        }

        public HttpResponseMessage Put()
        {
            return new HttpResponseMessage()
            {
                Content = new StringContent("PUT: Test message")
            };
        }
    }
}

Browser OK, but show error.

enter image description here

I have a problem with my development machine dotnetnuke installation. When I try to load the content of the page administration module under "Admin / Page Management", I get a JavaScript error

pages:2089 Uncaught TypeError: Cannot read property 'length' of undefined

Wich is because window.dnnLoadScriptsInAjaxMode is undefined

var loadScriptInMultipleMode = function(){
    for(var i = 0; i < window.dnnLoadScriptsInAjaxMode.length; i++){

When I look into the page code I can see and debug that the following if check fails: "item.indexOf('$crm_')" is not working.

(function($){
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(function (sender, args){
var dataItems = args.get_dataItems();
for(var item in dataItems){
    if(item.indexOf('$crm_') > -1){
        var content = dataItems[item];
        ...

Because dataItems contains all values for the ClientDependency placeholders with underscore "_" as a prefix. e.g "_crm_BodySCRIPTS" instead of dollar sign "$" "$crm_BodySCRIPTS", which is what the code expects.

In our production instance everything is working fine and I can not remember changing any prefix configuration for the ClientDependency Framework. Combining and minifying files is turned of as in the Administration.

Can anybody help with what could be wrong here?

This is the code in the default _Layout.cshtml that is added on creation of the project. This is shared by other views.

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/Site.css")
    <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="/Mvc/Scripts/modernizr-2.6.2.js"></script>
</head>

All other views are rendered properly when run locally, i.e. they all get the same basic styling when run from the visual studio. But the pages loose styling after I published it using IIS 10.0, yet give me the desired look when run locally. I am using Firefox and Chrome, and not Edge.

How do i solve this?

Eg.

 $(".button").click(function () {
                var index=$(this).closest('tr').index();
                var records=@Model.Task[index];               
            });

In this,index is javascript and @Model.Task is server side so error say "The name index does not exist in the current context".

I am trying to load angular2 module in a cshtml file. I have got the loading working with a html file so I have tried copying all the necessary scripts to cshtml file but it fails to load properly as it fails to load /app/main

This is the original html file tag.

<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <script src="/node_modules/es6-shim/es6-shim.js"></script>
    <script src="/node_modules/angular2/bundles/angular2-polyfills.js"></script>
    <script src="/node_modules/systemjs/dist/system.src.js"></script>
    <script src="/node_modules/rxjs/bundles/Rx.js"></script>
    <script src="/node_modules/angular2/bundles/angular2.dev.js"></script>
    <script>

    System.config({
        packages: {
            'app': {
                defaultExtension: 'js'
            }
        },
    });
    System.import('/app/main').then(null, console.error.bind(console));
    </script>
</head>

<body>
    <div> </div>
</body>

</html>
<pm-app>
    <div>
        <p> Please wait ...</p>
    </div>
</pm-app>

And it comes up with the following error:

Failed to load resource: the server responded with a status of 404 (Not Found)

I've tried this with a cshtml with the following code.

@{
    ViewBag.Title = "Index";
}
<script src="~/node_modules/es6-shim/es6-shim.js"></script>
<script src="~/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/node_modules/systemjs/dist/system.src.js"></script>
<script src="~/node_modules/rxjs/bundles/Rx.js"></script>
<script src="~/node_modules/angular2/bundles/angular2.dev.js"></script>
<script>

    System.config({
        packages: {
            'app': {
                defaultExtension: 'js'
            }
        },
    });
    System.import('/app/main').then(null, console.error.bind(console));
</script> 


<h2>Index </h2>

<pm-app>Loading App ...</pm-app>

And this comes up with the same error message. I have also tried 1. putting all the scripts in the header section of the layout page 2. Putting render section in the layout page and adding section in the index.cshtml file.

All three attempts gave me the same error message so I was wondering if this is just purely a bad practice to do it this way ( loading angular module in cshtml ) or if there is any fix to this.

Thanks for the help in advance.

Cheers.

I don't quite understand the following strongly typed models syntax:

@model IEnumerable<MvcMovie.Models.Movie>

@{
    ViewData["Title"] = "Index";
}

<h2>Index</h2>

<p>
    <a asp-action="Create">Create New</a>
</p>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Genre)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Price)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReleaseDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Title)
            </th>
            <th></th>
        </tr>
    </thead>

Why do we access the Genre property like this?

@Html.DisplayNameFor(model => model.Genre)

I thought that the model here refers to the whole container:

@model IEnumerable<MvcMovie.Models.Movie>

Am I wrong?

I am a beginner in .net I have an error in the following lines. I am not able to find out why the error actually arises.

@if(Model.FilteredDevice.Count()>0)
{
@foreach(FModel d in Model.FilteredDevice)
{
// other statements
}
}
else
{
<td> no text matching </td>
}

The complete error message is : An exception of type 'System.Web.HttpParseException' occurred in System.Web.WebPages.Razor.dll but was not handled in user code

Additional information: Unexpected "foreach" keyword after "@" character. Once inside code, you do not need to prefix constructs like "foreach" with "@".

I don't quite understand the following strongly typed models syntax:

@model IEnumerable<MvcMovie.Models.Movie>

@{
    ViewData["Title"] = "Index";
}

<h2>Index</h2>

<p>
    <a asp-action="Create">Create New</a>
</p>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Genre)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Price)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReleaseDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Title)
            </th>
            <th></th>
        </tr>
    </thead>

Why do we access the Genre property like this?

@Html.DisplayNameFor(model => model.Genre)

I thought that the model here refers to the whole container:

@model IEnumerable<MvcMovie.Models.Movie>

Am I wrong?

In my application after running the code in this page the user can see a audio file with ckeditor along with that he has radio buttons and a submit button now what i need i when he select third radio button which is named as re-work and click on submit the complete row in that gridview should go to the user only if the user is a transcriber that means he can see the records of all the people who may be transcribers,proofers,validators etc but the data should be sent to that user only if he is a transcriber

Admin adm;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session.Count > 0) { if (Session["uid"] != null) lblUser.Text = Session["uid"].ToString(); else Response.Redirect("Login.aspx?i=1"); } else Response.Redirect("Login.aspx?i=1");
        adm = new Admin();
        if (!IsPostBack)
        {
            ViewState["id"] = Request.QueryString["id"].ToString();
            GetAudio(Request.QueryString["id"].ToString());
        }
    }

    private void GetAudio(string ID)
    {
        DataSet ds = adm.MTGGetAudioForClientQC(ID, Session["uid"].ToString());
        if (ds.Tables.Count == 0)
        {
            btnCompleteTranscription.Visible = false;
            lblMessage.Text = "Transcription for selected fiel is not possible...";
            ViewState["id"] = "0";
            ViewState["dt"] = "";
        }
        else
        {
            lblMessage.Text = string.Empty;
            btnCompleteTranscription.Visible = true;
            if (ds.Tables[0].Rows.Count > 0)
            {
                ViewState["dt"] = ds.Tables[0];
                //ddlTemplates.DataSource = ds.Tables[0];
                //ddlTemplates.DataTextField = "TemplateName";
                //ddlTemplates.DataValueField = "TemplateName";
                //ddlTemplates.DataBind();
                //ShowTemplate((byte[])ds.Tables[0].Rows[0]["Template"]);
            }
            else
            {
                //ddlTemplates.Items.Clear();
                //ddlTemplates.DataBind();
            }
            if (ds.Tables[1].Rows.Count > 0)
            {
                DataTable dt = ds.Tables[1];
                string path = Server.MapPath("~/GT" + "/" + dt.Rows[0]["Filename"].ToString());
                //ViewState["af"] = dt.Rows[0]["ZipFileName"].ToString();
                ViewState["af"] = dt.Rows[0]["ZipFileName"].ToString().Substring(dt.Rows[0]["ZipFileName"].ToString().LastIndexOf(@"\") + 1).Replace(".gz", "");
                path = AudioFilename(dt.Rows[0]["ZipFileName"].ToString(), dt.Rows[0]["FileName"].ToString());
                dt.Columns.Add("audio", typeof(string));
                foreach (DataRow row in dt.Rows)
                {
                    row["audio"] = path;
                }
                dt.AcceptChanges();

                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = null;
                GridView1.DataBind();
            }
            if (ds.Tables[2].Rows.Count > 0)
            {
                //CKEditor1.Text = ds.Tables[2].Rows[0]["ProofingData"].ToString();
                CKEditor1.Text = ds.Tables[2].Rows[0]["TranscribedData"].ToString();
                //ViewState["mtd"] = ds.Tables[2].Rows[0]["ProofingData"].ToString();
                ViewState["mtd"] = ds.Tables[2].Rows[0]["TranscribedData"].ToString();
                //ViewState["templatecharcount"] = ds.Tables[2].Rows[0]["TemplateLineCount"].ToString();
            }
            else
            {
                CKEditor1.Text = string.Empty;
            }
        }
    }
    private string AudioFilename(string AudioFullPath, string OnlyFileName)
    {
        string APath = AudioFullPath;
        APath = "GT" + APath.Replace(@"C:\Eliscription\ToEliscription", "").Replace(@"\", "/");
        string OnlyAudioName = APath.Substring(APath.LastIndexOf("/") + 1);
        string OFName = OnlyFileName.Replace(".wav", "");
        string OnlyAudioName1 = OnlyAudioName.Replace(OFName, "");
        string DateFolder = OnlyAudioName1.Substring(0, 8);
        APath = APath.Substring(0, APath.LastIndexOf("/") + 1);
        APath = APath + DateFolder + "/" + OnlyAudioName.Replace(".gz", "") + ".wav";
        return APath;
    }
    protected void btnCompleteTranscription_Click(object sender, EventArgs e)
    {
        ViewState["pd"] = CKEditor1.Text;
        string Text = "<html><body>" + CKEditor1.Text + "</body></html>";
        Text = Text.Replace("&lt;", "<");
        Text = Text.Replace("&gt;", ">");
        Text = Text.Replace(">style=", "><span style=");
        Text = Text.Replace("<span <", "<span></span> <");
        Text = Text.Replace("<p <", "<p> <");
        Text = Text.Replace("<del", "<s><span");
        Text = Text.Replace("</del", "</s></span");
        Text = Text.Replace("&nbsp;", " ");
        Text = Text.Replace("<s style=", "<s><span style=");
        Text = Text.Replace("<p <", "<p style=\"text-align:justify\"><span><");
        string datefolder = DateTime.Today.Month.ToString().Length < 2 ? "0" + DateTime.Today.Month.ToString() : DateTime.Today.Month.ToString(); datefolder += DateTime.Today.Day.ToString().Length < 2 ? "0" + DateTime.Today.Day.ToString() : DateTime.Today.Day.ToString(); datefolder += DateTime.Today.Year.ToString();
        string QCPath = Server.MapPath("~/GDocs/" + Session["uid"].ToString().ToUpper() + "/QC/" + datefolder);
        if (!System.IO.Directory.Exists(QCPath))
        {
            System.IO.Directory.CreateDirectory(QCPath);
        }
        using (System.IO.StreamWriter file = new System.IO.StreamWriter(QCPath + @"\" + ViewState["af"].ToString().Replace(".wav", "") + ".Doc"))
        {
            file.Write(Text);
        }

        //get prof doc char count.
        string text = CKEditor1.Text;
        text = Regex.Replace(text, @"<[^>]+>|&#xa0;|&nbsp;", "");
        text = Regex.Replace(text, @"\s+", " ");
        text = text.Replace("&ndash;", "–");
        text = text.Replace("&rsquo;", "'");

        string status = "8";
        if (rbQCNotDone.Checked)
            status = "9";

        //int lineCount = text.Length - Int32.Parse(ViewState["templatecharcount"].ToString());
        //decimal lc = (decimal)(lineCount / 65f);
        //Compare();
        //ViewState["templatecharcount"]
        adm.MTGSaveClientQCWork(ViewState["id"].ToString(), CKEditor1.Text, Session["uid"].ToString(), "", status);
        Response.Redirect("MTGReadyToClientQCWorks.aspx");
    }

    public void Compare()
    {
        string firstDocument = CKEditor1.Text.ToString();
        string secondDocument = ViewState["mtd"].ToString();
        string secondDocumentFinal = Regex.Replace(secondDocument, @"<[^>]+>|&nbsp;", "").Trim();
        secondDocument = secondDocument.Replace("<span>", "<div>");
        diff_match_patch dmp = new diff_match_patch();
        var diffs = dmp.diff_lineMode(secondDocument, firstDocument);
        dmp.diff_cleanupSemanticLossless(diffs);
        var FinalDocument = dmp.diff_prettyHtml(diffs);
        CKEditor1.Text = "";
        string secondDocumentFinal1 = Regex.Replace(FinalDocument, @"&nbsp;|&para;|'&#39;", "").Trim();
        string Text = "<html><body>" + FinalDocument + "</body></html>";
        Text = Text.Replace("&lt;", "<");
        Text = Text.Replace("&gt;", ">");
        Text = Text.Replace(">style=", "><span style=");
        Text = Text.Replace("<span <", "<span></span> <");
        Text = Text.Replace("<p <", "<p> <");
        Text = Text.Replace("<del", "<s><span");
        Text = Text.Replace("</del", "</s></span");
        Text = Text.Replace("&nbsp;", " ");
        Text = Text.Replace("<s style=", "<s><span style=");
        Text = Text.Replace("<p <", "<p style=\"text-align:justify\"><span><");
        CKEditor1.Text = Text;

        string datefolder = DateTime.Today.Month.ToString().Length < 2 ? "0" + DateTime.Today.Month.ToString() : DateTime.Today.Month.ToString(); datefolder += DateTime.Today.Day.ToString().Length < 2 ? "0" + DateTime.Today.Day.ToString() : DateTime.Today.Day.ToString(); datefolder += DateTime.Today.Year.ToString();
        string ComparePath = Server.MapPath("~/GDocs/" + Session["uid"].ToString() + "/Compared/" + datefolder);
        if (!System.IO.Directory.Exists(ComparePath))
        {
            System.IO.Directory.CreateDirectory(ComparePath);
        }
        using (System.IO.StreamWriter file = new System.IO.StreamWriter(ComparePath + @"\" + ViewState["af"].ToString().Replace(".wav", "") + ".Doc"))
        {
            file.Write(Text);
        }
    }

Above is the code where a main user can see all the records that are done by different people and below is the code where user can see only his records

Admin adm;
protected void Page_Load(object sender, EventArgs e)
{
    if (Session.Count > 0) { if (Session["uid"] != null) lblUser.Text = Session["uid"].ToString(); else Response.Redirect("Login.aspx?i=1"); } else Response.Redirect("Login.aspx?i=1");
    adm = new Admin();
    if (!IsPostBack)
    {
        string date = DateTime.Today.Month.ToString().Length < 2 ? "0" + DateTime.Today.Month.ToString() : DateTime.Today.Month.ToString();                                            date += "/"; date += DateTime.Today.Day.ToString().Length < 2 ? "0" + DateTime.Today.Day.ToString() : DateTime.Today.Day.ToString(); date += "/"; date += DateTime.Today.Year.ToString();
        txtFromDate.Text = date; txtToDate.Text = date; FillDetails();
    }
}

private void FillDetails()
{
    DataTable dt = adm.MTGGetTranscriptionCompletedWork(Session["uid"].ToString(), txtFromDate.Text, txtToDate.Text);
    if (dt.Rows.Count > 0)
    {
        lblMessage.Text = dt.Rows.Count.ToString() + " Record(s) Found...";
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
    else
    {
        lblMessage.Text = "No Record Found...";
        GridView1.DataSource = null;
        GridView1.DataBind();
    }
}
protected void btnGetDetails_Click(object sender, EventArgs e)
{
    DataTable dt = adm.MTGGetTranscriptionCompletedWork(Session["uid"].ToString(), txtFromDate.Text, txtToDate.Text);
    if (dt.Rows.Count > 0)
    {
        lblMessage.Text = dt.Rows.Count.ToString() + " Record(s) Found...";
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
    else
    {
        lblMessage.Text = "No Record Found...";
        GridView1.DataSource = null;
        GridView1.DataBind();
    }
}

I am in the process of learning MVC, and it is proving to be quite an admirable foe seeing as how I'm used to web forms.

There are so many things I can do in web forms that I can't seem to replicate in MVC, and if I can I'm so lost when it comes to actually implementing it. But my question is as follow;

I have a table

public partial class Patient
{
    public Patient()
    {
        this.PatientHousings = new HashSet<PatientHousing>();
    }

    public Guid ID {get;set;}
    public string FirstName {get;set;}
    public string LastName {get;set;}
    public bool Incarcerated {get;set;}
    public bool Released {get;set;}
    public bool Deceased {get;set;}

    public virtual ICollection<PatientHousing> PatientHousings {get;set;}
}

And this is a other table

public partial class PatientHousing
{
    public Guid ID {get;set;}
    public Guid PatientID {get;set;}
    public bool CurrentPrevious {get;set;}
    public string Building {get;set;}

    public virtual Patient Patient {get;set;}
}

Okay, so in web forms I would just bind a dropdownlist to a datasource with the proper query. Well I can't do that with MVC, and I have to use the controller which I'm still bashing my head against the wall with.

I've read that I need to create a ViewModel to help me with this, so I've created the following

public class PatientViewModel
{
    public List<Patient> patients {get;set;}

    public PatientViewModel(){
        DATAEntities db = new DATAEntities();
        patients = db.Patients.Include(r => r.PatientHousings.Where(h => h.CurrentPrevious == true)).Where(x => x.Incarcerated == false && x.Released == false && x.Deceased == false && !string.IsNullOrEmpty(x.LastName)).ToList();
    }
}

Now I'm getting this error

 The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties.

Someone please help. I'm so lost right now it isn't even funny.

So, I have a list on the side and each of those supposedly are showing and displaying a panel when clicked on. But the last module I programmed just kinda refresh the page but does nothing, doesnt show the panel but all of the others are showing the panel without issues.

Heres a little bit of the section of the code.

    <tr id="trShare">
                                    <td>
                                        <asp:Image ID="imgShare" runat="server" ImageUrl ="Images/share.png" width="22px" height="22px" />
                                    </td>
                                    <td align="left" valign="middle">
                                          <asp:LinkButton ID="lnkShare" runat="server" Text="Share..." ></asp:LinkButton> 
                                    </td>
                                </tr>

<tr id="trEmail">
                                <td>
                                    <asp:Image ID="Image1" runat="server" ImageUrl ="Images/share.png" width="22px" height="22px" />
                                </td>
                                <td align="left" valign="middle">
                                      <asp:LinkButton ID="lnkEmail" runat="server" Text="Email Contact" ></asp:LinkButton> 
                                </td>
                            </tr>
<asp:Panel ID="panelShare" runat="server" CssClass="modalPopUp">
        <h2>Share this applicant</h2>
        <hr />
        <blockquote>
            <p>An email will be sent with a link to this page.  Please add a valid username.  Only @asf.edu.mx are allowed.</p>
            <p> <asp:TextBox ID="txtShareWith" runat="server" Width="120px"></asp:TextBox>@asf.edu.mx </p>
            <br /><br /><br /><br />
            <div style="text-align:right;">
                <asp:Button  ID="btnCancelShare" runat="server" Text="Cancel" CausesValidation="false" />
                &nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnShare" runat="server" Text="Share"  CausesValidation="false" OnClick="btnShare_Click" />
            </div>
        </blockquote>           
    </asp:Panel>
    <asp:Panel ID="panelEmail" runat="server" CssClass="modalPopUp">
        <h2>Share this applicant</h2>
        <hr />
        <blockquote>
            <p>An email will be sent with a link to this page.  Please add a valid username.  Only @asf.edu.mx are allowed.</p>
            <p> <asp:TextBox ID="TextBox1" runat="server" Width="120px"></asp:TextBox>@asf.edu.mx </p>
            <br /><br /><br /><br />
            <div style="text-align:right;">
                <asp:Button  ID="Button1" runat="server" Text="Cancel" CausesValidation="false" />
                &nbsp;&nbsp;&nbsp;
                <asp:Button ID="Button2" runat="server" Text="Share"  CausesValidation="false" />
            </div>
        </blockquote>           
    </asp:Panel>

    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender4" runat="server"
        PopupControlID="panelEmail" 
        TargetControlID="lnkEmail"
        CancelControlID="btnCancelEmail"
        BackgroundCssClass="modalBackGround" 
        DropShadow="true" ></ajaxToolkit:ModalPopupExtender>

    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
        PopupControlID="panelShare" 
        TargetControlID="lnkShare"
        CancelControlID="btnCancelShare"
        BackgroundCssClass="modalBackGround" 
        DropShadow="true" ></ajaxToolkit:ModalPopupExtender>

The Email section is the one that is not showing....at all.

I am wanting to make this model so that when a user types in a password, it checks to see if the entered value equals that of a particular column in the user database.

Here is my viewModel for resetting a password:

 public class ResetPasswordViewModel
    {
        [Required]
        [EmailAddress]
        [Display(Name = "Email")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 15)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        public string Code { get; set; }
    }

I am wanting to add it in right under StringLength, but I am wanting to do a string equals to or something. I am new to C# still. My first instinct is to do this logic in the controller, but since they checked the length in this example it leads me to assume that I might be able to do it here.

This is just the stock example that comes with visual studio that uses the identity class for users.

Also, I am unsure about the best way to accomplish this. Should I try to retrieve the un-hashed password and compare the actual string or should I hash the new (potential) password and then compare the hashed string?

Trying to update a variable at runtime with NLog on a vb.net (asp.net) application and doesn't appear to be working.

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
  autoReload="true"
  throwExceptions="false"
  internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">


<variable name="DebugInfoLayout" value="[${date:format=MM/dd/yyyy hh\:mm\:ss.fff tt}] [${gdc:item=location}]  |  ${level}  |  ${message}" />
  <variable name="InfoLayout" value="[${date:format=MM/dd/yyyy hh\:mm\:ss.fff tt}] ${gdc:item=SoftwareName} Version ${gdc:item=SoftwareVersion}  -  ${message}" />
  <variable name="LogLayout" value="[${date:format=MM/dd/yyyy hh\:mm\:ss.fff tt}] ${message}" />
  <variable name="logDir" value="C:/Logfiles/" />
  <variable name="ArchiveDir" value="C:/Logfiles/Archive" />
  <variable name="Line" value="" />

  <targets async="false">
    <target name="Errors" xsi:type="File" fileName="${logDir}/${var:Line}errors.log" layout="${DebugInfoLayout}" keepFileOpen="false" archiveFileName="${ArchiveDir}/errors_${shortdate}.{##}.log" archiveNumbering="Sequence" archiveEvery="Day" maxArchiveFiles="30" archiveOldFileOnStartup="true" />
    <target name="Info" xsi:type="File" fileName="${logDir}/${var:Line}info.log" layout="${InfoLayout}"  keepFileOpen="false" archiveFileName="${ArchiveDir}/info_${shortdate}.{##}.log" archiveNumbering="Sequence" archiveEvery="Day" maxArchiveFiles="30"/>
    <target name="Debug" xsi:type="File" fileName="${logDir}/${var:Line}debug.log" layout="${DebugInfoLayout}"  keepFileOpen="false" archiveFileName="${ArchiveDir}/debug_${shortdate}.{##}.log" archiveNumbering="Sequence" archiveEvery="Day" maxArchiveFiles="30" />  
  </targets>

  <rules>
    <logger name="Errors" minlevel="Trace" maxlevel="Fatal" writeTo="Errors" />
    <logger name="Info" minlevel="Trace" maxlevel="Warn" writeTo="Info" />
    <logger name="Debug" minlevel="Trace" maxlevel="Fatal" writeTo="Debug" />
  </rules>

</nlog>

The variable I am trying to update is called "Line" and I have the following code:

NLog.GlobalDiagnosticsContext.Set("Line", "myLine")

However - the log file name is always "debug.log" instead of "myLinedebug.log".

I am working with this project with Yeoman generator.

npm install -g yo generator-aspnetcore-spa

I want to include materialize-css in the project so I did:

npm install materialize-css --save

The node_modules is present but I do not know how to include it in the project.

I am using the "system.web.helpers.chart" and it is working (happen to be doing it in MVC but that shouldn't matter). But for the life of me, I can't seem to display the data like I want. All the examples seem to show what I'm looking for, but none of the code seems to back it up.

Take a simple data grid:

Fruit ........ Color ........ Quantity

Apples ....... Red .............. 5

Apples ....... Green ........... 3

Apples ....... Yellow ........... 2

Grapes ....... White ........... 20

Grapes ...... Red .............. 10

So all I'm looking for is like one of those "Column" charts, that should have the Fruit at the bottom. My Apples should have 3 columns grouped together (one for each color), and my Grapes should have 2 columns grouped together.

It's basically should look like ... with the exception that the fruit names be on the bottom, and the color be in the grid (or a legend)

enter image description here

Oh.. almost forgot.. basically here is my code...

SQL = "Select Fruit, Color, Quantity From Inventory"

Chart...

.AddSeries( chartType: "Column", xValue: myDataTable.Rows, xField: "Fruit", yValues: myData.Rows, yFields: "Quantity" );