.Net WebDAV Server - c#

I am looking to implement a WebDAV server in ASP.Net. the app will be deployed to IIS 6. I have seen a few frameworks that provide this functionality, but I can't seem to identify how they're able to accomplish it without (apparently) modifying IIS settings.
My specific question is how do I configure IIS and ASP.Net so that a IHttpModule/IHttpHandler might have an opportunity to handle any of the additional WebDAV verbs (i.e. LOCK, OPTIONS, PROFIND, etc.)

There is no way to configure WebDAV verbs in IIS 6 without modifying IIS settings. It is possible only with IIS 7 and later.
To handle all verbs required by WebDAV in IIS 6 you will need to create an application wildacrd map. Right click on your web application in IIS 6 MMC console and go to Properties->Virtual Directory Tab->Configuration. Click Insert to add new wildcard map.
Executable - \Microsoft.NET\Framework\<.Net
Framework Version>\aspnet_isapi.dll
Verify that file exists - Unchecked
On Home Directory tab of your application properties set Execute permissions to Scripts only and allow reads.
Here is the web.config example: http://www.webdavsystem.com/server/prev/v2/documentation/hosting_iis_asp_net/webconfig_example
Please note that this web.config example was specifically created and tested with ASP.NET 2.0 on IIS 6 on Server 2003 and IIS 5.1 on XP. It does not handle &, %, + and trailing dots (.).
ASP.NET 4.x provides means for handling any special characters in your WebDAV server, configuring web.config, including &, % and '.'. The web.config that supports IIS versions 6-8 is generated by IT Hit WebDAV Server Engine Wizard.

Check out Geoff Lane's articles on WebDAV:
http://www.zorched.net/2006/01/20/aspnet-web-application-without-aspx-extension/ - shows configuration of verbs in IIS and HttpModule setup.
http://www.zorched.net/2006/02/02/custom-webdav-server-using-net/
http://www.zorched.net/2006/03/01/more-webdav-tips-tricks-and-bugs/

I would take a look at this project http://sourceforge.net/projects/webdav/ for a webdav implementation in C#. If you must build your own it is nice to reference a completed one; even better if you can reuse it.
Yes, you will need to modify IIS6 settings to support binding the ISAPI module for .NET to all request types and not checking if a file exists. There is no other way to do this on IIS6 because web dev clients on windows will do an OPTIONS request on the root (/) of the website when checking for webdav support.
II7 gives you more options...

Related

How To Config MachineKey In Asp.Net Core In IIS Level

I have two server and in communication between servers I check Machine Key in IIS Level. Now I have a new project in net core and I want to check Machine Key like Asp.net projects. I search for this but can't find a solution
ASP.NET Core doesn't use Web.config, and even if it did, it doesn't use machine keys either. Cryptography is handled via the Data Protection API, which stores and generates keys in an entirely different way.
If you need to share things like cookies between ASP.NET and ASP.NET Core, you have to work in the opposite way and plug in the Data Protection API into your ASP.NET apps, so that they use the same system as ASP.NET Core. Microsoft has a guide for that.
Well, it kind of depends on exactly what you are doing. If your project uses Microsoft Identity, then Identity by default uses machine key as part of the hash. So, in my case, my site sends off an email asking a user to verify their email. The link includes what is basically a password hash encrypted - in part - with the machine key from the server it originated from.
So if the user clicked the link, and then ended up on a different server on the farm, the validation check fails unless the machine keys are set to be the same on the various servers behind the load balancer.
So at this point I haven't found any good way to set the machine key when publishing to IIS. The web.config is auto-generated during publish from my ASP.NET core project. The only solution I have found at this point is to manually open the web.config after publishing the project and insert the machine key section before deploying to the servers in the farm.

Setting MaxURLLength of HTTPGet Call in asp.net core

Hi I need to update the maxurllength of asp.net core service that is running on a service fabric cluster using kestral server.
Looking at other solutions people have recomended making changes to registry and web.config but in case of Kestral server running asp.net core on service fabric we dont have any web.config file.
Kestral server limits does not expose a way of doing this either. Is it possible to do so in ASP.net core?
Update:
I was using service fabric reverse proxy to access the service and a sample problematic URL is :
http://localhost:19081/{appname}/{servicename}/test-backend/v1.0/mode/1/context/5e2550ec-539a-4ea0-81b5-f783ce3f7c48/file/60917927-8a7d-4702-93e4-e2a5ea337937/version/2d826211703581a186b3d5d840e78117903189a5/openfile/W3sia2V5IjoiNjA5MTc5MjctOGE3ZC00NzAyLTkzZTQtZTJhNWVhMzM3OTM3OjJkODI2MjExNzAzNTgxYTE4NmIzZDVkODQwZTc4MTE3OTAzMTg5YTU6MCIsImNvbnRleHRJZCI6IjVlMjU1MGVjLTUzOWEtNGVhMC04MWI1LWY3ODNjZTNmN2M0OCIsImlNb2RlbElkIjoiNjA5MTc5MjctOGE3ZC00NzAyLTkzZTQtZTJhNWVhMzM3OTM3IiwiY2hhbmdlU2V0SWQiOiIyZDgyNjIxMTcwMzU4MWExODZiM2Q1ZDg0MGU3ODExNzkwMzE4OWE1Iiwib3Blbk1vZGUiOjEsIl9fbmFtZV9fIjoiSU1vZGVsVGlsZVJwY0ludGVyZmFjZV9JTW9kZWxUb2tlbiIsIl9fdW5yZWdpc3RlcmVkX18iOmZhbHNlfSwiMHgyWdpc3RlcmVkX18iOmZhbHNlfSwiMHgy
The last URL segment which is some encoded string is the issue.
For ASP.NET Core 1.1 KestrelServerLimits.MaxRequestLineSize should be what you are looking for.
For ASP.NET Core 2.1 KestrelServerLimits.MaxRequestLineSize should be what you are looking for.
The default on both is 8Kb, so that should be much bigger than the default 2083 Url length provided by chrome and other browsers.
If you are exposing your APIs using the Service Fabric Reverse Proxy, the problem should be the Reverse Proxy and not Kestrel.
Service Fabric Reverse Proxy uses the windows HTTP.sys driver to expose the http endpoints, by default this is limited to 260 chars per segment (values between each slash '/'), if this is the case, you should configure your machine with other values instead, in this case, you should set the value for UrlSegmentMaxLength
To do that you have to create a DWORD called UrlSegmentMaxLength under the following registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters
and set it to a number between 0 and 32,766.
I think if you provide the real problem, we could help with a better solution.
Just one side note: .NET Core apps can be hosted with IIS as well. In that case a Reverse Proxy talks to Kerstel. Also during "dotnet publish" a web.config created for this case to make IIS work with .NET Core.
So in this scenario it means you have to set up these hosting level changes in both places. I had a lot of problem with the configuration of IIS in a .NET Core project unit found this post.

Multiple IIS Application With Same C# MVC Controller

I'm building a site for SaaS.
I'd like to distinguish sites by Domain name to use same contoller.
The reason why I want to make multiple IIS Application is, There are tons of HttpContext.Current.Application in Application_Start() and OnActionExecuting(). And It should be isolated by domains.
My questions are :
Is there any solution for multiple IIS Application using same C# MVC controllers?
If not, Is there other container instead of HttpContext.Current.Application?
Or, Is there other solution that is more elegant, efficient, or effective?
What I tried for creating multiple IIS Application are :
Setting same path.
Set only bin directory to same path as virtual directory
However, Nothing works.
I Hope this is helpful
Windows Server 2012 / IIS 8.5
VS 2013 / C# MVC5 / .Net Framework v4.5.0
Thank you.
Is there any solution for multiple IIS Application using same C# MVC controllers?
Yes.
IIS7 - How do I use the same physical path for different domains?
Can I configure IIS to use the same physical path for different sites but use custom web.config
If not, Is there other container instead of HttpContext.Current.Application?
Or, Is there other solution that is more elegant, efficient, or effective?
It is possible to have multiple domains pointed to a single web application. For more information take a look at IIS Bindings

Http Redirect in IIS6

I need to implement a functionality in one of my web app in such a way that if i host a webapp in the IIS (let say
http://localhost/mywebapp
), it should also open through
http://localhost
I simply cannot install my web app on the root web app i.e.
http://localhost
For this, I found a setting in web.config for IIS7 named as HttpRedirect. Which i set programatically during application installation.
But, I wouldn't able find the same setting for IIS6 which i can set programmatically. I found a solution through which it can be done but its manually. http://www.serverintellect.com/support/iis/iis-url-redirect/
Any idea on how to create this programatically in IIS6.
I am using c# as a language in .net4.

IIS - Query for Web Sites

I'm working on an application which should add a vdir on the default web site.
Before adding the vdir I need to check whether the default web site exists.
The way I'm doing it today is using the DirectoryServices via c# (example).
The problem is that using the DirectoryServices on IIS7 is possible only when the IIS6 backwards compatibility roles are installed.
I have no problem with creating the vdir since it is done after adding the IIS6 b/w compatibility roles (yes, the default web site test must be before :-) ).
Is there any alternative way for querying the IIS?
Maybe through the registry/file system?
Thanks a lot.

Categories