Successfully I added some fields in AspNetUsers table but I don't know how I can retrieve them. My project is asp.net web api and I can retrieve username from token. I want to return departmentId by given userId, or username. like

public ????? GetDepartmentId(string name){
return db.[????].where(u =>u.userName == username)
}

Here is the way I could create fields in my AspNetUsers and I can insert values successfully. The problem is to return values from AspNetUsers.

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

        [Required]
        [Display(Name = "FirstName")]
        public string FirstName { get; set; }

        [Required]
        [Display(Name = "Lastname")]
        public string Lastname { get; set; }

        [Required]
        [Display(Name = "Department")]
        public int DepartmentId { get; set; }



        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [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; }
    }

And then the registerration

public async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email, Firstname = model.FirstName, LastName =        model.Lastname, DepartmentId = model.DepartmentId };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }

            return Ok();
        } 

Thank you in advance!

As part of my application I have a .Net Core API project. Unlike most cases where this project would run as its own process, I intend to have the API run in a thread, among others, in a single process. The reason for this is that the API acts as a web interface, operating on the same level as a local console interface. Both interfaces share a singleton object and perform operations on it (asynchronously). At least that is the plan. However, I have run into a problem.

I have this Startup.cs for the API:

public class Startup
{
    public Startup(IHostingEnvironment env)
    {
        var builder = new ConfigurationBuilder()
            .SetBasePath(env.ContentRootPath)
            .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
            .AddEnvironmentVariables();
        this.Configuration = builder.Build();
    }

    public IConfigurationRoot Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {.
        services.AddMvc();
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        loggerFactory.AddConsole(this.Configuration.GetSection("Logging"));
        loggerFactory.AddDebug();

        app.UseMvc();
    }
}

..which is the default with a few minor changes, and this method used to start the API:

public static void Run()
{
    var host = new WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseIISIntegration()
        .UseStartup<Startup>()
        .Build();

    host.Run();
}

What I cannot figure out is how to pass my instantiated object to the Startup so that I can then register it as a singleton and have it work with the controllers.

Is there a way to do this? If not, then what other approach could I take?

I cannot seem to get my routes "perfected". "pdm" is the virtual directory name. So my base url for the site is http://servername/pdm.

Here is my Route.config. I added what I expected to get under the mapping.

public static void RegisterRoutes(RouteCollection routes){
    var settings = new FriendlyUrlSettings();
    settings.AutoRedirectMode = RedirectMode.Permanent;
    routes.EnableFriendlyUrls(settings);

    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    RouteValueDictionary divisionValue = new RouteValueDictionary { { "division", "florida" } };
    RouteValueDictionary skuValue = new RouteValueDictionary { { "division", "florida" }, { "sku", "" } };

    /* route pages that have not been converted to mvc yet */

    routes.MapPageRoute("", "{division}", "~/Welcome.aspx", true, divisionValue);
    // Should show as servername/pdm/

    routes.MapPageRoute("Default", "Login", "~/Default.aspx", true);
    // Should show as servername/pdm/login

    routes.MapPageRoute("ProductDetails", "Product/Details/{division}/{sku}", "~/Products/Details.aspx", true, skuValue);
    // Should show as servername/pdm/Product/Details


    // mvc page routes
    routes.MapRoute(
         name: "ProductSearch",
         url: "Products/{action}/{division}",
         defaults: new { controller = "Products", action = "Index", division = UrlParameter.Optional }
     );
     // servername/pdm/Products/ 
     // or
     // servername/pdm/products/division

     routes.MapRoute(
         name: "PDM/Flow",
         url: "Flow/{action}/{division}/{search}",
         defaults: new { controller = "Flow", action = "Index", division = UrlParameter.Optional, search = UrlParameter.Optional }
     );
     // servername/pdm/Flow

     routes.MapRoute(
         name: "PurchaseOrder",
         url: "PO/{action}/{division}/{key}",
         defaults: new { controller = "PO", action = "Index", division = UrlParameter.Optional, key = UrlParameter.Optional }
     );
     // servername/pdm/PO
}

Some of these are working and some are not, but to get the ones not working to work the others then stop working. Also I believe this is affecting the RouteLink and ActionLink helpers.

Am I doing this correctly?

I'm looking for a simple way to create a running table of data input by a user in a submit form. The table really just needs to add a row with data that was just input, but more importantly, survive postback.

The table should have a header, then a row per 'set' of data entered the last submit.

For example:

<asp:Table ID="lastRecordTable" runat="server" ViewStateMode="Enabled" 
AutoPostBack="true">
        <asp:TableHeaderRow>
            <asp:TableCell>A</asp:TableCell>
            <asp:TableCell>B</asp:TableCell>
            <asp:TableCell>C</asp:TableCell>
            <asp:TableCell>D</asp:TableCell>
        </asp:TableHeaderRow>
        <asp:TableRow>
            <asp:TableCell>1</asp:TableCell>
            <asp:TableCell>2</asp:TableCell>
            <asp:TableCell>3</asp:TableCell>
            <asp:TableCell>4</asp:TableCell>
        </asp:TableRow>
    </asp:Table>

Code Behind:

                TableRow row = new TableRow();
                TableCell cell1 = new TableCell();
                TableCell cell2 = new TableCell();
                TableCell cell3 = new TableCell();
                TableCell cell4 = new TableCell();
                cell1.Text = 1.ToString();
                cell1.Text = 2.ToString();
                cell1.Text = 3.ToString();
                cell1.Text = 4.ToString();
                row.Cells.Add(cell1);
                row.Cells.Add(cell2);
                row.Cells.Add(cell3);
                row.Cells.Add(cell4);
                lastRecordTable.Rows.Add(row);

Any advice is appreciated.

I have a table in ssms with the PK id. I have an insert form on my asp.net website that allows the users to insert data into the table from the webpage. What I would like to is after the insert is complete to show a label showing the id number of what was just inserted to the user(I guess like a confirmation number). I was thinking a code like this maybe(using linq)

var myvar = from table in myentities.table
select table.id;
label1.datasource = myvar;
label1.databind;

I have an ASP.NET Core Web Application, and I am having some css issues. The standard _Layout.cshtml file that is created when the project is created has barely been touched, aside from a view name changes and a couple of pages have been added. Here, you can see the full _Layout.cshtml file:

@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
<!DOCTYPE html>
<html id="html">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - Biggest Loser</title>

    <environment names="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
    </environment>
    <environment names="Staging,Production">
        <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
    </environment>
    @Html.Raw(JavaScriptSnippet.FullScript)
</head>
<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Biggest Loser</a>
                </div>
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        <li><a asp-area="" asp-controller="Weights" asp-action="Index">Weights</a></li>
                        <li><a asp-area="" asp-controller="UserDetails" asp-action="Index">Target Weight</a></li>
                        <li><a asp-area="" asp-controller="Weights" asp-action="Summary">Summary</a></li>
                    </ul>
                    @await Html.PartialAsync("_LoginPartial")
                </div>
            </div>
        </nav>
        <div class="container body-content">
            @RenderBody()
            <hr/>
            <footer>
                <a href="http://www.needlecast.co.uk"><p>&copy; 2017 <img src="~/img/Asset 6.png" id="footerphoto" /></p></a>
            </footer>
        </div>

        <environment names="Development">
            <script src="~/lib/jquery/dist/jquery.js"></script>
            <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
            <script src="~/js/site.js" asp-append-version="true"></script>
        </environment>
        <environment names="Staging,Production">
            <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
                    asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                    asp-fallback-test="window.jQuery"
                    crossorigin="anonymous"
                    integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
            </script>
            <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
                    asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                    asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                    crossorigin="anonymous"
                    integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
            </script>
            <script src="~/js/site.min.js" asp-append-version="true"></script>
        </environment>
        @RenderSection("Scripts", required: false)
</body>
</html>

As you can see, it is almost identical to the original _Layout.cshtml (bar the aforementioned changes) that is created on project creation.

I have almost finished the project, however, I have hit quite a roadblock. Whenever I debug the project, this is what I am greeted with: https://i.stack.imgur.com/1dd5m.png

This is very different to what should be seen: https://i.stack.imgur.com/Xpk6M.png

Ignore the carousel and text, it is just the navbar that has disappeared as well as the formatting of the text on the Home/Index.cshtml view. The formatting was all working before I published it to Azure. The weird thing is, I have the project on source control and the previous versions (which worked before this, btw) now have the same problem. I have reset VS 2017 settings, all the code in the _Layout.cshtml has been reset and I have reset to the defualt CSS in the wwwroot folder. I have had someone with 30+ years on the issue but to no avail. Because of this, I have come to the internet to help me. If there are any other files or settings you need to see/know about, please comment and i will be happy to show you.

This question might be very basic but i'm very new to C#.I am returning list data from controller without using model. I want to use this and want to create a table.

      // Mycontroller
        public ActionResult Applied( string id)
        {
            try {
                List<GrindersForJob> Grinders = JobAppliedRepository.GetgrindersByJobId(id);
                return View(Grinders);
            } catch (Exception ex) {
                return View();
            }
           

        }

I have a table with data, inside some rows they have conditions. Based on the condition it will change the background colour of the table cell. Here is a td example

<td style="background-color: lightgreen">

Now i am writing a razor if statement.

@foreach (var fileDetail in Model.Folder1.FileDetails)
{
    if()
}

In the IF condition, how do i check whether ANY cells in the table are background coloured "lightgreen" ?

I've got a C#/asp.net Visual Studio 2015 solution. One of the projects there is a Telerik Reporting project with a catalog made up of two Telerik reports. These are .cs files. I'd like to change this to a report I can edit in Telerik's Report Designer, the stand alone (i.e. outside of Visual Studio) application that creates .trdx files. Is there a way to do this?

So here's how my existing Telerik report catalog and reports look in Visual Studio:

enter image description here

enter image description here

Here's the Telerik Report Designer program I want to open it in (or if I can't open it directly, to convert it to something that can be edited in Report Designer):

enter image description here

The new aspnet_merge 5.00 beta is only installable from nugget. to install on our build machine that doesn't have visual studio I want to use nugget.exe directly to get the package.

Anyone know if I can just replace the .EXE in the windows SDK ? I ask because in the SDK there is only the .exe but the beta came with more support files that I am unsure about.

I've created an asp.net panel and it is having an update panel. There is jquery used for the images to show and zoom. Whenever the page is first load and popup comes, the jquery works fine but whenever any operation is made the jquery don't work. How can I make jquery work inside the update panel because I've also tried to include jquery inside the update panel.

Below is the code of my update panel.

<asp:UpdatePanel ID="updatepaneldatalist" runat="server">
                                                                    <ContentTemplate>

                                                                        <script type="text/javascript">

                                                                            var prm = window.Sys.WebForms.PageRequestManager.getInstance();
                                                                            prm.add_endRequest(function () {




                                                                                $('.mix-grid').mixItUp();


                                                                                $('.mix-controls .select-all input').change(function () {
                                                                                    if ($(this).is(":checked")) {
                                                                                        $('.gallery').find('.mix').addClass('selected');
                                                                                        enableGalleryTools(true);
                                                                                    } else {
                                                                                        $('.gallery').find('.mix').removeClass('selected');
                                                                                        enableGalleryTools(false);
                                                                                    }
                                                                                });


                                                                                var SelectImage = function SelectImage() {
                                                                                    var mix = $(this).parents('.mix');
                                                                                    var labelMediaID = $(this).parents('.mix').find('.label');
                                                                                    var MediaID = labelMediaID.text();
                                                                                    var Image = $(this).parents('.mix').find('.img-responsive');
                                                                                    var ThumbnailURL = Image.attr('src');
                                                                                    var linkbutton = $(this).parents('.mix').find('.img-preview');
                                                                                    var MediaURL = linkbutton.attr("href");
                                                                                    var divImages = document.getElementById("divSelectedImages");
                                                                                    var labelImageCount = document.getElementById('labelImageCount');
                                                                                    var divSelectedImagePortion = document.getElementById('divSelectedImagePortion');
                                                                                    if (mix.hasClass('selected')) {
                                                                                        mix.removeClass('selected');
                                                                                        var checkboxfalse = mix.find(".check input:checkbox").prop("checked", false);
                                                                                        enableGalleryTools(false);
                                                                                        ImageCount--;
                                                                                        if (ImageCount == 0) {
                                                                                            divSelectedImagePortion.style.display = "none";
                                                                                        }
                                                                                        labelImageCount.innerHTML = ImageCount;
                                                                                        RemoveImages(MediaID);
                                                                                    }
                                                                                    else {
                                                                                        if (ImageCount >= 5) {
                                                                                            alert('You Can Upload Maximum 5 Images.');
                                                                                        }
                                                                                        else {
                                                                                            ImageCount++;
                                                                                            divSelectedImagePortion.style.display = "block";
                                                                                            var checkbox = mix.find(".check input:checkbox").prop("checked", true);
                                                                                            mix.addClass('selected');
                                                                                            enableGalleryTools(true);
                                                                                            AddImage(MediaID, ThumbnailURL, MediaURL);
                                                                                            var image = document.createElement('img');
                                                                                            image.id = CountSelectedImage;
                                                                                            image.src = ThumbnailURL;
                                                                                            image.addClass = "img";
                                                                                            image.height = 50;
                                                                                            image.style.padding = "0 3px";
                                                                                            image.width = 50;
                                                                                            image.alt = MediaID;
                                                                                            divImages.appendChild(image);
                                                                                            CountSelectedImage++;
                                                                                            labelImageCount.innerHTML = ImageCount;
                                                                                        }
                                                                                    }
                                                                                }

                                                                                $('.mix .img-select').add('.mix .img-details').on('click', SelectImage);


                                                                                $("#divGallery").on("scroll", function (e) {
                                                                                    var $o = $(e.currentTarget);
                                                                                    if ($o[0].scrollHeight - $o.scrollTop() <= $o.outerHeight()) {
                                                                                        GetRecords();
                                                                                    }
                                                                                });

                                                                                var hiddenScrollCount2 = document.getElementById('hiddenScrollCount').value = 0;
                                                                                var imagesAppendCount = document.getElementById('hiddenimagesAppendCount').value = 0;
                                                                            })




                                                                        </script>
                                                                        <div id="divContent" class="content">
                                                                            <div class="row mix-grid" style="margin-left: 4px;">
                                                                                <div class="gallery" data-lightbox="gallery">
                                                                                    <div class="" id="divUploadGallery" style="display: block" runat="server">
                                                                                        <div style="height: 19em; overflow: scroll; overflow-x: hidden;" id="divGallery">
                                                                                            <asp:DataList ID="datalistGallery" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="row  padd" DataKeyField="MediaId">
                                                                                                <HeaderTemplate>
                                                                                                </HeaderTemplate>
                                                                                                <ItemTemplate>
                                                                                                    <div class="col-md-2 col-sm-3 mb-20 mix mix_all" id="divMix" runat="server" style="display: inline-block; padding: 0px;">
                                                                                                        <div class="img-container">
                                                                                                            <asp:Label ID="labelMediaID" runat="server" Text='<%#Eval("MediaId")%>' CssClass="label" Style="display: none;"></asp:Label>
                                                                                                            <asp:Image ID="ImageProduct" runat="server" Style="height: 60%; width: 80%; }"
                                                                                                                CssClass=" img-responsive" ImageUrl='<%#Eval("ThumbnailURL")%>' ng-src='<%#Eval("MediaURL")%>' />
                                                                                                            <div class="img-details" style="cursor: pointer;">
                                                                                                                <asp:CheckBox ID="checkboxSelect" runat="server" CssClass="pull-right check" Style="display: block" />
                                                                                                                <div class="img-controls">
                                                                                                                    <asp:LinkButton ID="linkbuttonImageSelect" runat="server" CssClass="img-select" href="javascript:;">
                                                                                               <%--   <i class="fa fa-circle-o"></i>
                                                                                             --%>     <i class="fa fa-circle"></i>
                                                                                                                    </asp:LinkButton>
                                                                                                                    <asp:LinkButton ID="linkbuttonImagePreview" runat="server" CssClass="img-preview" data-lightbox="gallery-item" href='<%#Eval("MediaURL")%>' PostBackUrl='<%#Eval("MediaURL")%>' title="Admin Portal Gallery">
                                                                                               <i class="fa fa-search"></i>
                                                                                                                    </asp:LinkButton>
                                                                                                                </div>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                    </div>
                                                                                                </ItemTemplate>
                                                                                            </asp:DataList>
                                                                                            <img src="~/Images/loadin.gif" id="loader" runat="server" class="text-center" hidden="hidden" />
                                                                                        </div>
                                                                                        <br />
                                                                                        <br />



                                                                                        <div id="divSelectedImagePortion" style="display: none">
                                                                                            <div class=" pull-left">
                                                                                                <asp:Label ID="labelImageCount" runat="server" ClientIDMode="Static" CssClass=""></asp:Label>
                                                                                                <span>Selected</span>
                                                                                                <br />
                                                                                                <asp:LinkButton ID="linkbuttonClearSelection" runat="server" OnClientClick="ClearSelection();  return false;" CssClass="link-effect" Text="Clear" ForeColor="Red"></asp:LinkButton>
                                                                                            </div>
                                                                                            <div id="divSelectedImages" class="div pull-left">
                                                                                            </div>
                                                                                            <asp:UpdatePanel ID="updateImage" runat="server">
                                                                                                <ContentTemplate>
                                                                                                    <asp:Button ID="buttonSelect" runat="server" Text="Add To Product" OnClientClick="GetImages();  " OnClick="buttonSelect_Click" CssClass="btn btn-darkgray pull-right" />
                                                                                                </ContentTemplate>
                                                                                            </asp:UpdatePanel>
                                                                                            <asp:HiddenField ID="hiddenfieldSelectImage" runat="server" ClientIDMode="Static" />
                                                                                        </div>
                                                                                    </div>
                                                                                    <div class="embed-responsive embed-responsive-16by9 " id="uploadImage" runat="server" style="height: 35em !important; display: none; overflow-y: scroll !important">
                                                                                        <iframe class="embed-responsive-item" src="BlueImpFileUpload.aspx"></iframe>
                                                                                    </div>
                                                                                </div>




                                                                            </div>
                                                                        </div>



                                                                    </ContentTemplate>
                                                                    <Triggers>

                                                                        <asp:AsyncPostBackTrigger ControlID="linkbuttongallery" EventName="Click" />
                                                                    </Triggers>
                                                                </asp:UpdatePanel>

I have a asp.net web application and it has few application events; say for example - Create User. One of my clients want a notification when a new user is created. So I have a dll specific to that client where I can put the logic for sending notification by registering to the application event onCreateUser.

Now I would like to know is there a better and generic way so that by just replacing this dll, for a different client, I can do something else instead of sending notification. Or by simply removing the dll I can turn this behavior off.

Edit: I know it is possible to do this by dynamically loading dlls applying reflection using Attributes just like PreApplicationStartMethodAttribute or using Interface and so on. But wanted to make sure I am not reinventing the wheel.

I'm making a simple web app like Instagram. I want to store images for each user in separate table, for example:

  1. New users login is Bob123,
  2. Create a new record in table Users (Uzytkownicy) for Bob123,
  3. Create a new table, in the same database, called Bob123 and there store all Bobs images

I'm getting an error: Incorrect syntax near '@name'

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    try
    {
        if (temp == 0)
        {
            Guid newGuid = Guid.NewGuid();

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["UzytkownicyConnectionString"].ConnectionString);
            conn.Open();

            string insertQuery = "insert into Uzytkownicy (Id, Login, Password) values (@id, @Uname, @password)";
            SqlCommand com = new SqlCommand(insertQuery, conn);
            com.Parameters.AddWithValue("@id", newGuid.ToString());
            com.Parameters.AddWithValue("@Uname", TextBoxUN.Text);
            com.Parameters.AddWithValue("@password", TextBoxPass.Text);

            SqlCommand comm = new SqlCommand("CREATE TABLE @name ([Image] VARBINARY (MAX) NOT NULL);", conn);
            comm.Parameters.AddWithValue("@name", TextBoxUN.Text);

            com.ExecuteNonQuery();
            comm.ExecuteNonQuery();

            Response.Redirect("MainWebSite.aspx");
            conn.Close();
        }
    }
    catch (Exception ex)
    {
        Response.Write("Error: " + ex.ToString());
    }
}

I'm using .net core and have added some 4.5 libraries to my project. This works fine. But Visual Studio 2015 can't seem to find the "Controller" (which is a ASP.net core class) class.

My project.json file looks like this:

 {
  "dependencies": {
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "net452": {
      "dependencies": {
        "ClassLibrary1": {
          "target": "project"
        },
        "ClassLibrary2": {
          "target": "project"
        }
      }
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

When declaring a controller, the "AspNetCore.Mvc" package is not found. And the "Controller" class is not found.

using Microsoft.AspNetCore.Mvc;
namespace WebInterface.Backend
{
    public class AppController : Controller
    {
    }
}

I'm suspecting that there is something wrong with my project.json but can't seem to find the problem. Any suggestions?

I want static HTML file to hit the global.asax file when it get loaded I am using .NET Framework version 2.0

I have some paragraphs in a database that actually are a list of elements, but were copy and paste all the text as one paragraph from a Word document.

enter image description here

Now I need to show the text with the same style, if I just show the text in the html it looks like a paragraph with the bullets included in the text. I have been looking for html tags that respect the new lines in the text and I found <pre> I have been working with some option for made the result with the same style that the rest of the view, but I am stock trying to change the indentation. So far what I have is this:

enter image description here

pre {
   display: block;
   padding: 9.5px;
   font-size: 13px;
   font-family: sans-serif;
   line-height: 1.42857143;
   color: #333;
   border-radius: 4px;
   overflow: initial!important;
   white-space: pre-line;
}

I need the text align with the text not with the bullets like I have now. I am looking for something that allow me change that or maybe another way to show the text.

I'm trying to convert text from a textbox to an int, which is then used as a parameter when calling a method from a webservice. I'm getting this error:

An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code

Any help?

Heres my code

            int amount= int.Parse(txtAmount.Text);

            Service1Client connectionToService = new Service1Client();

            lblResult.Text = connectionToService.getCurrencyName(amount, "Rupee", "Euro");

So far I have

  @if (!(Model.CurrentVersion.LRC.List == Model.PrevVersion.LRC.List))

I want to see if the list from the previous version matches the current version however this only returns true (with the !). Both of the lists are empty but it's not returning false.

Is there a better way of seeing if lists match? And why is it always returning true?

Thanks!

I am beginner in .NET and I am learning MVC pattern. I am building a demo application which demonstrate CRUD Operations on any product. Before I use any database connectivity, I decided to test it with in memory variable. My code is as below:

Model Class

public class Product
{
    [Key]
    public int Id { get; set; }

    [Required]
    [Display(Name="Name")]
    public String ProductName { get; set; }

    [Required]
    [Display(Name="Price")]
    public float Price { get; set; }

    [Display(Name="Discription")]
    public String ProductDiscription { get; set; }
}

Controller Class

public class ProductController : Controller
{
    //
    // GET: /Product/
    public ActionResult Index()
    {
        return View(new Product{Id = 01, Price=100, ProductName="MyProduct", ProductDiscription="30 TeaBags in a pack"});
    }
}

View

    @model CrudAppDemo.Models.Product

@{
    ViewBag.Title = "Products";
}

<h2>Products</h2>

<div class="row">
    <div class="col-md-4 ">

        <table class="table">

            <thead>
                <tr>
                    <td>@Html.DisplayNameFor(model => model.Name)</td>
                    <td>@Html.DisplayNameFor(model => model.Price)</td>
                    <td>@Html.DisplayNameFor(model => model.Description)</td>
                </tr>
            </thead>

            <tbody>
                    <tr>
                        <td>@Html.DisplayFor(model => model.Name)</td>
                        <td>@Html.DisplayFor(model => model.Price)</td>
                        <td>@Html.DisplayFor(model => model.Description)</td>                        
                    </tr>
            </tbody>

        </table>

    </div>
</div>

When I am running this code, I am getting CS0411 Error:

enter image description here

IDE :: VS.NET 2015

Version Upgrade :: 4.5 To 4.6.1

My asp.net solution contains more than 30 projects inside. I have upgraded the targeted framework to 4.6.1 and now i am getting these tons of error in EF classes. The existing EF version is 6.0.

Please suggest how to fix these errors cropped up from the EF classes. Should i upgrade the EF version also from the Nuget console also.

enter image description here

i am using oracle.dataaccess.dll Version=4.112.2.0

Problem: oracle.dataaccess.dll.refresh does not exist in file location.

what i tried:

1) i went to visual studio 2012 > solution> manage nugetpackage but i cannot find the .dll with the same version as listed.

2)

Warning 21 Unable to update auto-refresh reference 'oracle.dataaccess.dll'. Cannot find assembly 'G:\Working autoCR CFG edit \app\product\11.2.0\client_1\odp.net\bin\4\Oracle.DataAccess.dll'. G:\Working autoCR CFG edit \myVS2012WebApps\AutoCR\Bin\oracle.dataaccess.dll.refresh

i created that above file path within my folder, and copy the .dll from my c:// and pasted onto my created file path. but it is still giving me that warning.

is there something i am doing wrong? what should i do?