Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8010783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:50:36+00:00 2026-06-04T18:50:36+00:00

I’m trying to use SVN patch files to remove authentication from a web API

  • 0

I’m trying to use SVN patch files to remove authentication from a web API while I’m developing. The patch file to remove authentication works fine and looks like this:

Index: WebApplication.Api/Global.asax.cs
===================================================================
--- WebApplication.Api/Global.asax.cs   (revision 18939)
+++ WebApplication.Api/Global.asax.cs   (working copy)
@@ -115,7 +115,7 @@
             _dependencyRegister.AddRegistration<WebApplication.Application.Aspects.AuthorisationAspect>();

             // WebApplication.Application.CurrentUser
-            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Application.CurrentUser.CurrentUserService>();
+            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Api.DummyServices.CurrentUserService>();

             // WebApplication.Application.Interface.Manager
             _dependencyRegister.AddRegistration<WebApplication.Application.Interface.Manager.IAspNetMembershipManager, WebApplication.Application.Manager.AspNetMembershipManager>();
Index: WebApplication.Api/Web.config
===================================================================
--- WebApplication.Api/Web.config   (revision 18939)
+++ WebApplication.Api/Web.config   (working copy)
@@ -64,14 +64,12 @@
     </sessionState>
       <httpModules>
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
-          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </httpModules>
   </system.web>
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
       <modules runAllManagedModulesForAllRequests="true">
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
-          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </modules>
       <httpErrors existingResponse="PassThrough" />
   </system.webServer>

As you can see, it changes the DI implementation of an interface and removes two nodes from an XML configuration file.

Since there is no way (that I have found) to reverse apply a patch (I’m using VisualSVN in Visual Studio to apply the patch), I have created a ‘reverse patch’ based on the original patch file:

Index: WebApplication.Api/Global.asax.cs
===================================================================
--- WebApplication.Api/Global.asax.cs   (revision 18939)
+++ WebApplication.Api/Global.asax.cs   (working copy)
@@ -115,7 +115,7 @@
             _dependencyRegister.AddRegistration<WebApplication.Application.Aspects.AuthorisationAspect>();

             // WebApplication.Application.CurrentUser
+            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Application.CurrentUser.CurrentUserService>();
-            _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Api.DummyServices.CurrentUserService>();

             // WebApplication.Application.Interface.Manager
             _dependencyRegister.AddRegistration<WebApplication.Application.Interface.Manager.IAspNetMembershipManager, WebApplication.Application.Manager.AspNetMembershipManager>();
Index: WebApplication.Api/Web.config
===================================================================
--- WebApplication.Api/Web.config   (revision 18939)
+++ WebApplication.Api/Web.config   (working copy)
@@ -64,14 +64,12 @@
     </sessionState>
       <httpModules>
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
+          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </httpModules>
   </system.web>
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
       <modules runAllManagedModulesForAllRequests="true">
           <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
+          <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
       </modules>
       <httpErrors existingResponse="PassThrough" />
   </system.webServer>

Rather simplistically, all I have done is change + symbols to – and vice versa. This creates a reverse patch file which makes sense to me.

The reverse patch works fine except that the final ‘line add’ in the XML config file, as well as adding the line, also removes several of the following lines, resulting in badly-formed XML.

Can anyone advise why this is? Do I need to do something with the magic @@ -64,14 +64,12 @@?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:50:38+00:00Added an answer on June 4, 2026 at 6:50 pm

    It seems the simplest way to do this is through the command line. I can’t find any way to apply a patch file in reverse through the UI of either Visual SVN or Tortoise, and I’ve no idea why the manual modification to the patch file didn’t work.

    In the command line, navigate to the working copy directory and enter the following command to apply a patch file:

    svn patch [path and name of patch file]
    

    To apply it in reverse:

    svn patch --reverse-diff [path and name of patch file]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a bunch of posts stored in text files formatted in yaml/textile (from
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.