missing System.Web.Security in project - security

I am working on a web project with .Net core 3.1.
I need to use FormsAuthentication.SetAuthCookie in login action and when i add using System.Web.Security to project its unknown. I cant add this using.
I read all posts about but still wasn't able to solve this.

I studied many references and finally the result was nothing else this :
System.Web.Security only is available with .net framework and in core has no alternative or i couldn't find it.

Related

Azure Function Structure

I'm trying to wrap my head around how we're supposed to build Azure functions.
I love the idea of building serverless, compact, single-function apps that respond to events.
Here are the problems I'm running into:
I have nice class libraries built in .NET Standard 2 that handle all my "backend needs" namely handling CRUD ops with Cosmos Db, Azure Table Storage, Azure SQL, Redis, Azure Storage. No matter what I did, I couldn't integrate these class libraries into an Azure Functions project. More details below.
Also, getting dependency injection in Azure Functions project has proven to be quite a task -- especially with my class libraries mentioned above.
At this point, the only option I'm seeing is to "copy and paste" code into a new Azure Functions project and use it without any DI.
This seems to go against "best practices". So what's the solution other than either to create monolithic code or wait till Azure Functions support .NET Core and DI.
I thought I could use my .NET Standard class libraries from a regular Azure Functions project targeting .NET Framework. After all, the idea of .NET Standard is to "standardize" things. I opened a couple of posts here on SO. I'm providing the links so that you can see the issues I've run into:
Using .NET Core 2.0 Libraries in WebJob Targeting .NET Framework 4.7
No parameterless constructor error in WebJobs with .NET Core and Ninject
P.S. My previous posts are referring to WebJobs. That was plan B approach because WebJobs seem half a step ahead of Azure Functions when it comes to supporting things like .NET Core and DI. Ultimately, I'd like to build a few Azure Functions that can use my class libraries built in .NET Standard 2.
Also, my previous posts mention that my class libraries target .NET Core 2.0. Since then I converted them to .NET Standard 2 which didn't really take much at all. I did this so that I truly conform to .NET Standard 2.
One issue is that Visual Studio has an outdated version of the Functions Core tools. Until this is resolved, you can work around in the following way:
Install the latest via npm by running npm install -g azure-functions-core-tools
In your Function App in VS, go to the Properties
Go to Debug, and click New... under Profile
Name the new Profile something like FunctionsNpm
Set the executable to (replace [YourUserName]): C:\Users\[YourUserName]\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\func.exe
Set the arguments to host start
Set the working directory to $(TargetDir)
In toolbar, look for the green triangle icon to change your current Profile to the one you just created:
Now when you run from VS, you'll be using the npm tools instead of the older one that come with the VS package.
.NET Standard 2 support is on its way, see this github issue.

System.TypeLoadException on Azure App Service

I'm running an asp.net 4.6 app on the app service. Just removed mvc from the site and using url rewrite to run an mvc free angular spa with a webapi.
Now it's asking for a type that was renamed months ago and works in pre mvc removal builds. I don't think it's got something to do with mvc though.
In trying to solve this I've xeroxed my local bin folder onto the server and the error still persists. So some sort of server config?
Has anyone ever experienced this before?
The error means that you are using a type which is not found in your assembly. To troubleshoot this issue, you need to find where you used this type. I suggest you use the Find in files feature provided by Visual Studio by pressing Ctrl+Shift+F. After found the place which used the type, you just need to delete it and rebuild your application.

ELMAH for asp.net core

I am working on asp.net core webapp hosted on azure and I want to write my Elmah logs to my azure table storage .Many of the examples I looked into are using "API_KEY" and "logbucketId" but I am not sure what they are.
For instance as per elmah docs here https://docs.elmah.io/logging-to-elmah-io-from-aspnet-core/
app.UseElmahIo(
"API_KEY",
new Guid("LOG_ID"),
After installing nuget package, I don't see any API_KEY or LogBucketId in my appsettings.json file.
Where I can find my API_KEY and LogBucket_Id ?
https://github.com/ElmahCore/ElmahCore supports .net core now.
It is not based on Modules or Handlers, but Middleware.
It works fine although still limited.
The async calls are not being used at the moment. But it is quite extensible.
ELMAH doesn't work with ASP.NET Core, since ASP.NET Core doesn't work with HttpModules and HttpHandlers (ELMAH stands for Error Logging Modules And Handlers). ASP.NET Core does include a new (pre-release) diagnostic tool called ELM (Error Logging Middleware - creative, right?). You can find its source and samples here:
https://github.com/aspnet/Diagnostics/tree/release/1.1/src/Microsoft.AspNetCore.Diagnostics.Elm
Another option similar to ELMAH (and ELM) but with more capabilities is Glimpse:
http://getglimpse.com/
I realize neither of these directly answers your question but hopefully you'll find one or both of these alternative tools useful.
You can check ELMAH port to Net.Core version
https://github.com/ElmahCore/ElmahCore
Make sure it is matching your expectation before you use it.
Note: This new extension is in development and doesn't support all Elmah features.
ELMAH doesn't support ASP.NET Core. The documentation you are linking to is from elmah.io. While they have similar names and elmah.io uses ELMAH for some of its integrations, they don't share code or documentation.

different between ServiceStack.Interfaces.dll and ServiceStack.ServiceInterface.dll

Recently I am working on servicestack project. When I am trying to add open ServiceStack.ServiceInterface in project it is showing below error.
PFB image for code.
As suggested in error, when i am trying add open ServiceStack.Interfaces then it is showing dll is not present.
please tell me why it is showing error?
What is different of this two DLL?
ServiceStack.ServiceInterfaces contains interfaces used by the ServiceStack webstack while ServiceStack.Interfaces is used by the various other ServiceStack projects (like OrmLite) as well.
ServiceStack.ServiceInterfaces depends on ServiceStack.Interfaces, which means you have to install it as well (it is a seperate nuget package)

Setting up Umbraco project with nuget in vs 2012 error

I'm trying to set up a development project in vs 2012 with nuget and Umbraco. I am aware of the several recipe's, amongst the better Umbraco for beginners: Setup Umbraco on localhost together with VS 2012 and uSiteBuilder.
When I am using this procedure I install Umbraco with nuget and build it without problems, but when I hit F5 I get the same error continously: "Could not load type Umbraco.Web.UmbracoApplication" which global.asax inherits from!
What is wrong, what am I missing here...? Thanks in advance /Finn
A bit late, but I had the same problem and the reason for that are missing dll's. Referenced libraries weren't copied to bin folder.
It is not the best or easiest way of setting the project up.
Instead of creating a WebForm project, create an empty MVC4 project and then install the Umbraco CMS from NuGet. This way you won't have to remove anything. It will also by default use IIS Express, so there is no need to change the project properties.
You don't even have to use the NuGet console. You can use the package manager and just search for Umbraco.
Well it seems like an unprofessional oversight from my point! I just forgot to give security access to the relevant folders to network service.
You might have to build and clean the solution a couple of times if you get exposed to the YSOD error: "Cannot create/shadow copy 'filename' when that file already exists" when you hit F5! This error might occur if you hit F5 too quickly after a build, in this case asp.net is probably not finished with whatever it has to complete, and the file is locked.
#Digbyswift: I do not agree with you! Whether you set up your project as an MVC or Webforms application, it doesn't matter. What is important though, is that you use empty applications, as if you don't there will probably be some references/dependencies that you have to delete in order to get the application running! And default server will be the vs dev server, which in my opinion is by far the best and easiest to use untill you are ready to deploy your application. I agree thouhg that using the package-manager from visual studio is the easiest way to come around installing Umbraco.
Following these steps and hints you should use no more than a couple of minutes from installing Umbraco untill you have the wellcome screen and is ready to set up db etc...
Cheers Finn...

Resources