I am looking to make a ComboBox in my razor pages just like the ComboBox they have in the normal Windows Forms .NET framework in the Ajax Toolbox.
Does anyone know how to get that?
I am looking to make a ComboBox in my razor pages just like the ComboBox they have in the normal Windows Forms .NET framework in the Ajax Toolbox.
Does anyone know how to get that?
Hi folks,
Here is my code as below:
[HttpGet("Download/{id}")] public FileStreamResult ([FromRoute] int id) { var getFile = _context.UploadPoliceReports.FirstOrDefault(m => m.UserVehicleID == id); //var getFile = _context.UploadPoliceReports.where(m => m.UserVehicleID == id); MemoryStream ms = new MemoryStream(getFile.Data); return new FileStreamResult(ms, getFile.ContentType); }
I am getting only one image file (Dino11.jpg) and it seems good.
Now I want to display all images (Dino11 and Dino22) from database where UserVehicleID has two same ID with different images.
Any idea?
I am waiting for your response.
Thanks in advance!
I have written two simple web projects...
The first site is up and running using the standard template layouts... this site is fine.
The second site, I added some CSS to site.css (background image), I edited the bundlesconfig.json file and added minify: {enabled: true }, however after publishing the site, the CSS is not reflected in the web site... I have edited the _layout.cshtml and pointed to the site.css and not site.min.css and things are working, however it would really be nice to get the minification to work...
Any help would be appreciated,
Stew Baterash
Hello, this question is posted in StackOverflow without response in two days. For this reason I make a duplicate here.
I have a Core 2 Framework Project. I use Core 2 for performance and need to use Framework 4.6.1 for accesing hardware (printer, serial ports, etc...), I use 4.6.1 to target Windows 10 Aniversary Update.
The main Project is a Core 2.0 MVC Project (Core2FrameWork in the sample Project)
It references a .NET Framework 4.6.1 Library Project (FrameWork461 in the sample Project)
FrameWork461 Project references "System.Printer.dll" (I tested with other System.* libraries with the same error result)
When I call a method with "System.Printer" reference I got a "FileNotFoundException: Could not load file or assembly 'System.Printing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. El sistema no puede encontrar el archivo especificado."
The sample Project is available here
In this simple project, the Home/Index page calls FrameWork461.Working class, and it Works.
The home/NoWorking page calls FrameWork461.NoWorking class, and it do not Works.
As a workarround, I applied the solution exposed in this page: Cannot resolve assembly paths for reference compilation libraries #2981 (it's included in the sample project).
It happends running in IIS, in StandAlone .exe and publishing.
Sorry for my bad English!
Thanks for your help!
Hi Guys.
How are you doing?
I was wondering the easiest way to accomplish the following:
Web app, run server opens a html5 form on a local lan computer different from the server.
The user inputs the address of the application he/she wants to open and where on the screen that application should open, x,y position and size.
Apps like Chrome, Firefox, Autocad, M.Office, VLC, RDP.
I know it can be done with PID, class or windows title, but since this future application that will be opened, was never opened previously on the server, how to predict those infos(windows title, class and PID)? After the application address on server, and it's parameters, Press a button and GET those infos dynamically?
What;s more, after open 3,4,6,7 apps together on the screen, I would like to be able to save the content , size and location of each individual window, as a preset/layout.
How can I accomplish this? Needs to work on Windows 10.
Thanks.
When I dove into the default code for the windows default razor page project with authentication I found that the username is automatically set as the email. I was able to change that so users can set their own usernames upon registering. What I then discovered is that the code for logging in uses the username to login NOT the email address. What I would like to do is change it so that people login with their Emails not Usernames.
It all says email, but it is pulling it as the UserName...
[Required] [EmailAddress] public string Email { get; set; }
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: true);
I have an MVC Core project in which the client admin wants to review people who register on the site before they are approved for different roles, etc. When the person registers, they see a page with this content: "Thank you for registering with us! An Administrator will authenticate your request and send you a confirming e-mail message soon." The following is code that I tried, but obviously it is for an immediate confirmation of an account. Any clues on how to accomplish what I need to do? In other words, I want the first e-mail notification to go to the client admin, not the new user.
if (result.Succeeded) { var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.Action(nameof(ConfirmEmail), "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme); //await _emailSender.SendEmailAsync(model.Email, "Confirm your account", $"Please confirm your account by clicking this link: <a href='{callbackUrl}'>link</a>"); _logger.LogInformation(3, "User created a new account with password."); return View(result.Succeeded ? "Welcome" : "Error"); }
Having trouble enabling both Anonymous and Windows authentication working when using http.sys as webserver in ASP.NET core 2.0. It works fine when I host in IIS but refuses to work in http.sys server. Method tags
[Authorize]on HomeController
Windowsaction fails with HTTP 500 and never prompts for authentication.
Program.cs
.UseHttpSys(options => { options.Authentication.Schemes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM; options.Authentication.AllowAnonymous = true; options.UrlPrefixes.Add("http://localhost:5000"); })
HomeController.cs
[Authorize] public class HomeController : Controller { [Authorize] public IActionResult Windows() { return Content ("You are " + User.Identity.Name + "; Authentication Type:" + User.Identity.AuthenticationType ); } [AllowAnonymous] public IActionResult Anonymous() { return Content ("You are " + User.Identity.Name + "; Authentication Type:" + User.Identity.AuthenticationType );; } }
Hello,
i use ReflectionIT.Mvc.Paging . If i klick of paging is comming home\Index\page=Numberpage...!
But my site name is other.. i need following home\othersite\page=Numberpage.. What is my Error..
Here is a part of code in PaginatedList.cs
namespace FIS.EKB.ProjektDB.Models
{
public class PaginatedList<T> :List<T>
{
public int PageIndex { get; private set; }
public int TotalPages { get; private set; }
public PaginatedList(List<T> items, int count, int pageIndex, int pageSize)
{
PageIndex = pageIndex;
TotalPages = (int)Math.Ceiling(count / (double)pageSize);
this.AddRange(items);
}
public bool HasPreviousPage
{
get
{
return (PageIndex > 1);
}
}
public bool HasNextPage
{
get
{
return (PageIndex < TotalPages);
}
}
public static async Task<PaginatedList<T>> CreateAsync(IQueryable<T> source, int pageIndex, int pageSize)
{
var count = await source.CountAsync();
var items = await source.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToListAsync();
return new PaginatedList<T>(items, count, pageIndex, pageSize);
}
}
}
in View Site is:
@model ReflectionIT.Mvc.Paging.PagingList<tabAuftragsdatenwert>
@using ReflectionIT.Mvc.Paging
@addTagHelper *, ReflectionIT.Mvc:Paging
@{ViewData["Title"] = "PdOverView"; }
<div>
<nav aria-label="Oernekler">
@await this.Component.InvokeAsync("Pager", new {pagingList = this.Model })
</nav>
<table class="table table-striped">
<thead>
<tr>
<th id="th_1">KommisionsNr</th><th id="th_2">S/U/G/E/ER/R/V-Nr</th><th id="th_3">Maschinentyp</th><th id="th_4">Linie</th><th id="th_5">Kunde</th>
<th id="th_6">Land</th><th id="th_7">Stadt</th><th id="th_8">Datum</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td><a asp-action="PdOverView" asp-route-id="@item.ID">@Html.DisplayFor(modemItem => item.KommissionsNr)</a></td>
<td>@Html.DisplayFor(modemItem => item.SUGEER_Typ)@Html.DisplayFor(modemItem => item.SUGEER_Nr)</td>
<td>@Html.DisplayFor(modemItem => item.MaschinenModell)</td>
<td>@Html.DisplayFor(modemItem => item.Linie)</td>
<td>@Html.DisplayFor(modemItem => item.Kunde)</td>
<td>@Html.DisplayFor(modemItem => item.Land)</td>
<td>@Html.DisplayFor(modemItem => item.Stadt)</td>
<td>@Html.DisplayFor(modemItem => item.Lieferdatum)</td>
</tr>
}
</table>
Thanks for Answers
I am using cookie authentication middleware for authenticate users in asp.core web application. Following are the lines of code which i am setting in "Startup.cs" class:
app.UseCookieAuthentication(new CookieAuthenticationOptions() { AuthenticationScheme = "CookieAuthentication", LoginPath = new Microsoft.AspNetCore.Http.PathString("/Login/Index/"), AccessDeniedPath = new Microsoft.AspNetCore.Http.PathString("/Login/Denied/"), ExpireTimeSpan = TimeSpan.FromSeconds(300), SlidingExpiration = true, AutomaticAuthenticate = true, AutomaticChallenge = true });
As described in above code lines, I have set 5 min of cookie expire time span. Now, if i signed-In into web application at the time span 05:00:00. So, the expiration time of authentication cookie will be at 05:05:00. After that i am sending a second request at the time span 05:03:00. So, the expiration time of authentication cookie must be extend and will be 05:08:00. But, if user try to send a another request at 05:06:00 then he/she is redirected onto login screen back.
Please provide me a appropriate solution if any. Here help would be more appreciated.
~Ashish Bhalodiya
hi team, i was trying to publish .net core 1.1 application and i am facing weird errors, components which supposed to be published not copying during publishing event not sure what could be causing this issue
i could see only asset folder after publishing the application in debug/release mode
other folders structure like components. not being copied..
it would be great if some one throw some light on this issue...
asp.net core 1.0
vs 2017 15.3
I'm a noob to .NET CORE and MVC and I'm not understanding why, when accessing the database, My controller methods should use "async Task<IActionResult>..." and when I call the database I'm using "await". I can access the database perfectly fine without doing this, but it seems wrong (according to examples I've read).
Can someone clarify why I should be doing it this way?
I have a asp.net core 2.0 mvc project with two areas and no default layout in the root.
The shipped handler calls a static path, UseExceptionHandler("/Home/Error"). How does one associate an area specific handler with its area?
Hello
How to get rid of the DB storage for
var result = await SignInManager.PasswordSignInAsync(model.Login, model.Password, model.RememberMe, shouldLockout: false);
This is an example from the MSDN Bootstrap demo project and I would use it as a starting point but this OAuth poses huge problems.
I have a different storage for passwords, different way for verification, etc. Can I override its interfaces with my implementation? Can I avoid using of EF?
Any clue?
Thanks.
Hi,
How to route subdomains to areas/controller using Core and test a sample subdomain url in Localhost?
If I have localhost:8996, having subdomain.localhost:8996/ doesn't work.
Request.RequestContext.RouteData.Values["subdomain"];
I can't understand what i can do for migration database for my production server. Local machine work properly
I have ASP.NET Core 2.0 application, and in publishing setting i have settings for migration to remote database and its worked (database created with all tables)...
What i do:
1. Remove local database
2. Add-Migration Initialize
3. Update-Database
4. Publishing web site (and database created on remote server with all i need tables)
After I open my production web site and see "There are migrations for ApplicationDbContext that have not been applied to the database" and button for "Apply Migrations", when i click i have a error: "An error occurred applying migrations, try applying them from the command line" and some options for update manualy.
My manualy command "dotnet ef database update" on production have error "No executable found matching command "dotnet-ef"
I have a PHP dashboard system that uses MS SQL Server and Stored Procs,
I am revamping ti to ASP.Net MVC Core , so for now I need to know how can I call the existing Login Stored Proc using ASP.Net Core Identity ?
How would I go about customizing SignInManager and UserManager to use my existing database stored procs / tables for queries?
OR If I were to create a Repository that can call my existing stored procs , how I would I get it to work with UserManager and SignInManager ?
This is my existing Login stored proc:
PROC [dbo].[AccessLogin]
@User varchar(255)
, @Password varchar(255)
, @NewPass1 varchar(255) = NULL -- Non-blank to change password
, @NewPass2 varchar(255) = NULL
, @IpAddress varchar(255) = NULL -- To allow automatic login from internal IPs (eg VPN)
, @Cookie varchar(128) = NULL
, @ResultSet bit = NULL -- Default 1
, @SessionId int = NULL OUTPUT
, @UserId int = NULL OUTPUT -- For AccessCheckSession
, @ErrorId int = NULL OUTPUT
, @ErrorMessage varchar(255) = NULL OUTPUT
, @debug int = 0
I pass in parameters fro @User/@Password/@Cookie
@Cookie, I auto-generate combination of alphanumeric string ... then i carry this cookie the entire application as it is being use by other Procs that I query
It returns the output parameters and the resultset if I set @ResultSet = 1
Please advise on how I can use this above on my ASP.Net MVC Core application using ASP.Net Core Identity ?
I use the following packages on my app:
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /><PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" /><PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
I'm attempting to create a project in Visual Studio 2015 that uses Angular, mvc. I'm going according to an article on CodeProject.com that others seem to be able to get to work.
https://www.codeproject.com/Articles/791740/Using-AngularJs-ASP-NET-MVC-Web-API-and-EntityFram
I cannot. It blows up in the build with the following errors:
2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(8,12,8,25): error CS0433: The type 'AssemblyTitleAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(9,12,9,31): error CS0433: The type 'AssemblyDescriptionAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(10,12,10,33): error CS0433: The type 'AssemblyConfigurationAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(11,12,11,27): error CS0433: The type 'AssemblyCompanyAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(12,12,12,27): error CS0433: The type 'AssemblyProductAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(13,12,13,29): error CS0433: The type 'AssemblyCopyrightAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(14,12,14,29): error CS0433: The type 'AssemblyTrademarkAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(15,12,15,27): error CS0433: The type 'AssemblyCultureAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(16,12,16,30): error CS0433: The type 'InternalsVisibleToAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(21,12,21,22): error CS0433: The type 'ComVisibleAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(24,12,24,16): error CS0433: The type 'GuidAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(36,12,36,27): error CS0433: The type 'AssemblyVersionAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\Source\Workspaces\AngularMVC\AngularMVC.Application\Properties\AssemblyInfo.cs(37,12,37,31): error CS0433: The type 'AssemblyFileVersionAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' 2>C:\Users\lstockton\AppData\Local\Temp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs(4,46,4,70): error CS0433: The type 'TargetFrameworkAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Essentially, this conflict exists. If I remove the reference to netstandard, then I get errors that it's referencing objects that don't exist and that I need to create a reference to netstandard 2.0.0.0. and if I create that reference, then I get this conflict.
I came across something as Microsoft ASP.NET Core 1.0.0 RC2 Local Feed on a machine.. What exactly is Local Feed?
Mariam
I am no stranger to programming. I am at the point to where I really want to understand how these technologies (c# and asp.net core) work at a technical level.
in order to do this, I have turned to reading the Microsoft documentation which has a bunch of namespaces, the classes in that name space, etc; there is a small catch, though... I do not know how to read the documentation nor comprehend it. I know what I am looking at is valuable and could help me but I'm just not picking up what they are putting down.
When I watch videos of people that teach technologies, such as asp.net core, they know what classes are new, what methods are in that particular class, and what the methods do. How do they get that information?
I assume it is from reading the asp.net core documentation.
my goal: I want to be able to search through the docs, find what I need, know what I am reading, then implement my findings inside of my application.
does anyone have a good resource as to where I can learn how to read the documentation and implement it ?
Thanks,
Michael