Simulating POST with Fiddler

Sometimes its useful to simulate POST action on a WebForm or a Webservice in ASP.NET for debugging.  Fortunately Fiddler allows you to compose (construct) such a request.  First thing to do is fire up Fiddler.  Jump to the “Request Builder” tab.

image

From the drop down, select “POST”.  Put the URL you are testing in the textbox.  The other thing to input is in the “Request Headers” field which is to let the receiving page that form data is being passed.  “Content-type: application/x-www-form-urlencoded”

image

The final piece of data is the key value pairs of the data to be passed.  Make sure these values are URL encoded.  Put this in the “Request Body” field.

image 

One setting to change is to ensure that request will be automatically tracked.  Switch to the option tab, as ensure “Inspect Session” is checked.

image

Click “Execute” to fire off the request.  This can be really useful if you need to debug something.  Make sure your ASP.NET development server is running.  In this case mine is running on localhost, port 8080.  Set your breakpoint in Visual Studio and then fire off the request.  Then the breakpoint will catch and you can step through.  This is a great way to test different variations of data POSTs.

Technorati Tags: ,,,,
6. May 2010 07:40 by Danny Gershman | Comments (3) | Permalink

Configuring ASP.NET MVC on IIS6

23. March 2010 08:30 by Danny Gershman | Comments (4) | Permalink

BlogEngine.NET custom captcha

One of the biggest flaws with my blog was that there was no CAPTCHA  ("Completely Automated Public Turing test to tell Computers and Humans Apart.)  Wikipedia article here.

I was getting comment spammed.  This I hope will reduce if not eliminate BOTS from putting false comments into my blog.  BOTS do this to increase their ranking on search engines in order to get more hits to their sites, when a keyword is entered.

Upon looking at the code for BlogEngine.NET, I did notice that there looked like there was some DEV in the area of the CAPTCHA, but it wasn’t fully implemented.

There is still one minor security flaw in my CAPTCHA design.  Once it’s fixed I will reveal what it was and how I fixed it.  In the meantime, I’ve gone ahead and deleted all fake comments and uploaded the new code.

If you try to comment on my blog now, you’ll see a little picture with some number on it.  The picture is of one of my cats “Sneakers”.  If the number is typed incorrectly, you won’t be able to post the comment.  Some of the messaging needs fixing as well.  This is definitely a good feeling project for me.

image

24. December 2009 12:36 by Danny Gershman | Comments (2) | Permalink

Determine ASP.NET root page

Sometimes when an ASP.NET page loads up from the root of a directory, the page name is not revealed via HTTP headers.  If it’s a webforms application, simply scroll down the Postback form section. (id=”aspnetForm”)

Look at the action attribute.  See the sample below.

<form name="aspnetForm" method="post" action="Home.aspx" id="aspnetForm">
Technorati Tags: ,,,
3. December 2009 06:55 by Danny Gershman | Comments (0) | Permalink

Run ASP.NET Development Server without Visual Studio

Ever want to run ASP.NET development server without having to fire up Visual Studio Debugger.

You can create your own scripts or commands by being able to access this.

%WINDOWS PATH%\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.exe

Here is the command line options as shown without setting any parameters.  Enjoy!

image

5. August 2009 07:11 by Danny Gershman | Comments (3) | Permalink

URL Rewrites in WCF

I had posted an entry to StackOverflow earlier today.  But I was able to resolve before I got an answer.  When handling URL rewrites in WCF, it’s important to include the trailing forward slash in the URL.  You can this in my example below.

 

public class FormatModule : IHttpModule
{    
#region IHttpModule Members    
 
     public void Dispose()    
     {       
          throw new NotImplementedException();   
     }   
    
     public void Init(HttpApplication application)    
     {        
          application.BeginRequest += new EventHandler(application_BeginRequest);   
     }    
 
     void application_BeginRequest(object sender, EventArgs e)   
     {       
          HttpContext context = HttpContext.Current;       
          if (context.Request.RawUrl.Contains(".pox"))             
               context.RewritePath("~/Lab1Service.svc?format=pox", false);        
          else if (context.Request.RawUrl.Contains(".json"))             
               context.RewritePath("~/Lab1Service.svc?format=json", false);   
      }    
#endregion
}
 
What I needed to do was to include the trailing slash as seen below.

 

context.RewritePath("~/Lab1Service.svc/?format=pox", false);
Technorati Tags: ,,
12. May 2009 10:31 by Danny Gershman | Comments (0) | Permalink

ReBind ASPX.VB/CS (Codebehind) to ASPX

Something has happened to a solution file that I’m working with and the codebehind has been unbinded from it’s ASPX page.  Use the following technique to rebind in VS2003

image

Right-click an ASPX page and select “View Code” (You can highlight multiple ASPX pages, by using Ctrl+Click)

image

The code will now be rebinded, as see below.

image

23. March 2009 16:57 by Danny Gershman | Comments (2) | Permalink

About dannyg

dannyg has been writing software for the last 12+ years and worked with various languages and programs.  He specializes business process automation, versatile solutions and R&D.