.status-msg-wrap { display: none; }
Tuesday, July 31, 2018
no image

ASP.NET Request Pipeline (OWIN & HttpModules)

Hello,

I'm hoping that someone here can help point me in the right direction. Bit of background, I am tasked with updating our application's authentication to interface with Azure AD, instead of our on-prem Active Directory. After taking a look around, it seems that OpenID Connect is the way to go (Seamless SSO is a requirement). There is a library maintained by Microsoft (Microsoft.Owin.Security.OpenIdConnect) that uses OWIN middleware to handle all the dirty stuff under the hood, but my application is a little too old for OWIN. It is built using a .NET CMS (Web Forms, C#). This framework is using the older HttpModules to authenticate requests; aside from modifying it to authenticate and authorize against our AD, there have been no customization made to their code-base. Completely overhauling the asp.net pipeline to OWIN does not seem feasible at this point. I also don't think it's a good idea to try and write my own library to handle OpenID's protocol. The only HttpModule example I've found does not seem to be actively maintained.

Is it possible to run OWIN middleware alongside existing HttpModules? I am only interested in replacing the authentication portion. Could I simply deregister the HttpModule responsible for authentication in the web.config, and create a Startup class that only registers my OpenID middleware?

What would be your recommendation for integrating OpenID Connect in this scenario?

Thanks in advance.

ASP.NET Request Pipeline (OWIN & HttpModules) Click here
no image

Any clear tutorial on how to deploy a ASP.NET Core 2.0/2.1 Application to AWS WITH SQL Server

Trying to find a tutorial that is moderately straightforward and demonstrates deploying an ASP.NET Core 2.0/2.1 application to Amazon Web Services. I want to learn how to deploy the application with authentication (built in identity auth is fine) that uses SQL Server (not sqlite). Anyone know any good ones to follow?

Any clear tutorial on how to deploy a ASP.NET Core 2.0/2.1 Application to AWS WITH SQL Server Click here
no image

Best way to resize an image in .Net Core?

Ive been looking for different ways to resize an image using various libraries. Ive heard system.drawing isnt very good anymore, and the ImageSharper library has performance issues with resizing. This image resizing service will be hit 10 of thousands of times a day so performance is important.

Any thoughts?

Thanks

Best way to resize an image in .Net Core? Click here
no image

Referencing Interop Assemblies

Hey all, first of all please let me know if there's a better sub for this. I am very unfamiliar will all the .NET concepts, I don't have time to learn a lot about them, and I haven't been able to find an answer online so far--so here I am. I'm pretty sure at least part of this question falls under the .NET umbrella but honestly, I may be totally off-base.

I have two DLL's provided by a third party company that I need access to in my own C# project, DNVideoXLib and AxDNVideoXLib (they're for controlling microscopes). I also have a sample C# project that makes use of the activeX one to display the video feed on a form. The other DLL exposes a single class that throws a catastrophic COM exception when you try to reference any members, so I'm assuming it's just a dependency for the activeX one.

Right now I'm just trying to duplicate the sample code in a new project, but I get an assembly not found exception when trying to reference anything from them (even though visual studio can see their contents). In the reference properties pages in the sample project they are both listed as File type: ActiveX and Name: (Ax)Interop.(Ax)DNVideoXLib. Additionally, those interop prefixed files do seem to be generated automatically when building the project. I cannot figure out how to reference them the same way in my own project. I tried copying their entries in the sample's .csproj into my own, but they still just show up as normal assembly references.

Sorry if any of that wasn't coherent. Again I have only a vague idea what half of these things are and I honestly just need this shit to work.

Referencing Interop Assemblies Click here
Monday, July 30, 2018
no image

PLEASE HELP: Master page is in binary?

So today was working away bopping my head away to some electro swing and coding away when out of no where power went out for a few seconds. No biggie I'll just loose 5 mins of work, CTRL + S every 5 mins anyways. Now I open up my new master page I see the following;

https://i.imgur.com/pX2bmRV.png

Only other post on the internet about this is

https://forums.asp.net/t/1649550.aspx?I+have+a+Master+Page+site+Master+file+that+now+contains+nothing+but+hex+code+mainly+0+s+and+1+s+How+can+I+fix+it+

and I cannot copy the first column of numbers or anything at all since when I try to paste it pastes nothing??

If I do not get this file back I'll be loosing a lot of days of work. (should of used TFS) but its legacy website that I am just doing a little renovation on!

Any ideas?

PLEASE HELP: Master page is in binary? Click here
no image

Keep getting this error when I try to add a new connection from server explorer

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I've done all the basic troubleshooting from google and still get this error. I'm using VS2017 and MSSQL Express 2017. I created a db using SSMS.

Keep getting this error when I try to add a new connection from server explorer Click here
Sunday, July 29, 2018
no image

SharpPCap - IPTraf like output possible?

Hello all,

I am finding myself hung up on the filter concept in SharpPCap, as that is not what I am trying to collect. I want to show an output kinda like IPTraf, being a report of every address and every report, and the amount of bandwidth they use for that duration. Is that possible with SharpPCAP? https://github.com/chmorgan/sharppcap/tree/master/Examples

The examples all seem to be based on filtering down to something specific, but I am not hunting for data, I just want to show all the data much like iptraf does.

Thanks so much for your comment and time

SharpPCap - IPTraf like output possible? Click here
no image

FP.Memoization - Easy function memoization

While I was at work I needed to memoize some functions for an ASP .NET Core application, I had a look around GitHub and NuGet and most packages were targeting the full Net Framework, were very old or had very complicated caching mechanisms that are hard to invalidate or to cleanup.
Inspired by the wonderful reselect Javascript library and because I wanted something compatible with .NET Core I’ve wrote my very own super simple memoization library called FP.Memoization (had to add a namespace because “Memoization” was already existing on NuGet).

Let me know what you think about it !

NuGet: https://www.nuget.org/packages/FP.Memoization/#
GitHub: https://github.com/federico-paolillo/memoize

FP.Memoization - Easy function memoization Click here
no image

Correct way to clear objects in Terminal.GUI?

I've been using Terminal.Gui and successfully am able to .Add, but I can't determine the correct way to remove them and effectively redraw a new window. Can anyone point me at an example or guide to removing the objects and basically making a new page?

Thanks

Correct way to clear objects in Terminal.GUI? Click here
Saturday, July 28, 2018
no image

How easy is it to remove dependency of Asp.Net from Bootstrap?

I notice that every time I start an ASP.Net project, there's a load of bootstrap and jquery, which is nice if you need them, but I don't. Especially when I'm trying to build a site to show off my vanilla CSS talents. I don't want Bootstrap interfering with anything I'm working on, so I figure the best way of doing this is just removing all traces. Is it? Or can I get around it somehow without deleting it?

How easy is it to remove dependency of Asp.Net from Bootstrap? Click here
no image

How to figure out why I am getting a CS5001?

I inherited a .NET framework 4.6 web application. When I press F5 to run it I get a CS5001(Program does not contain a static 'Main' method suitable for an entry point).

There's Program.cs in the root directory that contains a:

public static void Main(string[] args)

so it must be something with the config or some file references are messed up.

Visual Studio says that the CS5001 is occurring on line 1 of the CSC file.

How would you approach uncovering what the issue is?

How to figure out why I am getting a CS5001? Click here
Friday, July 27, 2018
no image

Creating a Controller that can be Registered in every project

We are moving to Kubernetes with dotnetcore webapi's. About 50 of them. Part of the requirement is Kubernetes using a liveness probe to check to make sure the application is still functional. It's a simple controller that should be stanardized in every project. How would you go about doing this in .netcore?

Creating a Controller that can be Registered in every project Click here
no image

C# - How to apply ToUpper() or other function to each member/property of a class.

I have a large number of classes where I need to force uppercase and filter out special characters for all the string members and properties.

I'm assuming reflection is the answer but I'm not sure how to implement it effectively.

So I'd like to have a utility class/function where I can pass a class object like the one below to it and have all strings converted to upper case.

For the class below, I'd expect these members/properties to have their values converted to uppercase after I make the one utility function call:

- FirstName

- LastName

- CompanyName

- WebUrl

public class Employee

{

public string FirstName { get; set; }

public string LastName { get; set; }

public int Age;

private DateTime StartDate;

public string CompanyName;

private string WebUrl;

}

We will get a lot of reuse out of this function so is greatly appreciated.

C# - How to apply ToUpper() or other function to each member/property of a class. Click here
Thursday, July 26, 2018
no image

Identity authentication to React

Hey guys,

I'm currently working on a ASP.NET Core MVC application and we recently had to create a React Application separated from the ASP project, which request on a controller dedicated to it. But obviously authentication doesn't work and I don't want to rework the whole thing with JWT authentication like Auth0. What are my options?

Thanks!

Identity authentication to React Click here
no image

Populate dropdown list from a DB table (ASP.NET CORE MVC)

Hello Redditers,

I'm Working on a web application project using ASP.NET Core MVC and EF.

I have a model script for a Address that has a property called "Country" of type string, There is a "Create" view where the user can create addresses and store them in the database, I need the page to have a dropdown list that has all the countries and the user can choose from them instead of having to type the country, and I need the items in that dropdown list to be retrieved from the DB

so I have a model script called "CountryModel" that has 2 properties: ID, CountryName.

I've been scratching my head over how to create a dropdown list in the Create view and have it retrieve data from a table in the database, and then have the selected value be saved in another model (Address model) as a string within the same view.

any thoughts ?

Thank you.

Populate dropdown list from a DB table (ASP.NET CORE MVC) Click here
no image

Learning Asp.NET using Asp.net Core

We have an existing ASP.NET web API that needs further development at work. Since I learn best by doing, I want to create a demo project at home and learn from it (using pluralsight).

Problem is, I run Linux at home my only option is using ASP.NET Core. Is it possible to learn ASP.NET using linux? how different is it from the Windows version?

thanks

Learning Asp.NET using Asp.net Core Click here
no image

I Want to Talk Repositories

I'm not sure that I've seen a more hotly debated topic other than the repository and unit-of-work pattern in dotnet. This is especially relevant in ASP.NET and when working with entity framework.

I am still undecided on the necessity of repositories.

I'd like to hear from the community on what practices you follow and why!

A few arguments about repo and UoW that we see a lot:

  • EF DbSet works like a repository anyway.
  • EF DbContext works like a UoW anyway.
  • Reusable queries can be place on extension methods for DbSet<T>.
  • DbSet methods return IQueryable that encourage developers to extend queries throughout the application.
  • Repositories allow you to slightly decouple from your persistence framework.
  • Projects rarely switch persistence frameworks without other major application changes.
I Want to Talk Repositories Click here
no image

Laptop recommendations for .net & python

Hi all,

I'm looking to upgrade my laptop in the next month or two, and I wondered what suggestions you had.

I'm new to .net development, as I mainly use Python, but I will be doing more .net going forwards so I wanted a machine that could handle it easier going forward.

Im looking at a surface book 2 right now, but they are pricey. Are there comparable alternatives other than the Dell XPS?

I'd be looking for min specs of 16gb RAM, i7 or similar, and 256gb SSD.

Looking forward to your thoughts.

Laptop recommendations for .net & python Click here
Wednesday, July 25, 2018
no image

What's the best way to handle multiple HttpClients that might have varying BaseAddresses (depending on the request)?

So I've done some reading and obviously the best way seems to be having a singleton of the HttpClient, or even better instantiated from the HttpClientFactory as the factory will handle the disposal and DNS updates for you.

Now my issue is I might have up to 3000 different addresses it might connect to. What is the best approach to this? Right now I'm looking at named clients in the HttpClientFactory but can I create them at runtime? Will they still be managed correctly?

What's the best way to handle multiple HttpClients that might have varying BaseAddresses (depending on the request)? Click here
no image

.net core on linux

Hello everyone.

My question will be simple, i don't intend to bash nor windows nor c#.

I am a student in a university and one of my teachers saw that I'm one of the few people that codes on his own so he suggested me to go to his friend company for work. That's what i did.

Company uses .net core / angular js.

My background is c / java and lately only Python, which i try to "master". Those work out of the box on Linux and i hadn't any problem doing my job.

Since i write in Python i chose to write the back end on the project, which is c# (.net).

All good here. Thing is that those technologies do work on Windows out of the box with VS which is awesome, but overkill for me. They gave me a laptop with windows.

I would like to ask if it's possible to write that stuff in Linux where i feel better and more familiar.

I use only vim, but VSC has a good Vim plugin that works well, so i can use that.

If it's not possible, then i will use the work's laptop.

As i have said, this is not a post that wants to make windows look bad, i just don't like to use it that much.

Thanks.

.net core on linux Click here
no image

Private NuGet Server and AD Authentication

Hi dotnet'ers! I am looking for some clarification on hosting a private NuGet server within my organization. My organization wants a place to store various PowerShell modules for use internally. After lots of research, I discovered that hosting a NuGet server may be perfect for this. I have a free edition of ProGet spun up, and also a NuGet server that was spun up via Visual Studio hosted on IIS. My question is about AD authentication with the Visual Studio NuGet server. Is it possible to offer AD authentication with a self-hosted NuGet server? I know ProGet offeres LDAP/AD integration, but honestly, I want to be able to do it without having another company do it for me.

I am not *too* familiar with authentication or even NuGet for that matter. From what I have researched it seems like I can add windows authentication to the server, and then create a service account user for the server in my company's domain, and join it to the domian. From there, some black kerberos magic would happen, and allow other users to authenticate.

Again, all of what I stated above, is just my understanding, and I am new to all of this. Please correct me where necessary, and provide any tips you can share!

Private NuGet Server and AD Authentication Click here
no image

How do I search a dll for xaml resources?

To create a merged ResourceDictionary I need the pack uri, but I can't seem to find any way to query an assembly for these things. Is this something that must be written in documentation or are there ways to extract them?

How do I search a dll for xaml resources? Click here
no image

Question to .net gurus Kernelbase.dll crash

Obvioulsy I am not a developer. But I have different apps that randomly crashes with Error: KERNELBASE.DLL . If I turn on service "Performance Logs & Alerts" the apps don't crash any more. For me it seem that the developer have built in a "Performance counter" without checking if the service "Performance Logs & Alerts" is running or if it has returned a result from the count - hence KERNELBASE.DLL crash.

Could there be substance in what I think may be the problem?

Performance Logs & Alerts is a service that starts on demand if one start prefmon.

Question to .net gurus Kernelbase.dll crash Click here
no image

Setting up databases with winforms

I’m creating a simple application with a relatively small database. Which approach is recommended? I know there’s ADO.net and entity framework. I’m not familiar with either. Do I set up the database from visual studio or do I need sql+ or something?

Setting up databases with winforms Click here
no image

Classic ASP connection to SQL

Hi,

i have successfuly connected to my sql server with

"objConn.Open "DRIVER={SQL Server};SERVER=xxxxxxxxxxxx; UID=xxxxxxxxxx;PWD=xxxxxxxxx;DATABASE=xxxxxxxxxxxxx"

however this means that my user id and password and all that are sitting hard coded in my code and thats just Dumb.

my boss wants me to make an ODBC and some how replace the above code with it can this be done and if so how

Thanks for your feed back,

Classic ASP connection to SQL Click here
The webdev Team