Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

ASP.NET Ajax requests not displayed #359

Closed
grahammendick opened this issue May 25, 2013 · 8 comments
Closed

ASP.NET Ajax requests not displayed #359

grahammendick opened this issue May 25, 2013 · 8 comments
Assignees
Milestone

Comments

@grahammendick
Copy link

Relates to the latest Glimpse.AspNet on .NET 4.5 and IIS Express.

Problem
Create an ASPX page consisting of a ScriptManager and an UpdatePanel containing a Button. Clicking the button results in a partial page request but the request information is not displayed in the Glimpse UI.

Fix?
The response, generated by .NET, from the partial page request has a content type of "text/plain" and so its data is filtered out by the ContentTypeWhiteList.
This can be fixed by adding this content type to the ContentTypeElementCollection constructor.

    public ContentTypeElementCollection()
    {
        BaseAdd(new ContentTypeElement { ContentType = @"text/html" });
        BaseAdd(new ContentTypeElement { ContentType = @"application/json" });
        BaseAdd(new ContentTypeElement { ContentType = @"text/plain" });
    }
@avanderhoorn
Copy link
Member

If you have a look at the implementation -

https://github.com/Glimpse/Glimpse/blob/master/source/Glimpse.Core/Policy/ContentTypePolicy.cs#L91-L98

you will see that at the bottom it talks about how you can add your own
content types to the ones that Glimpse picks up on. This is also documented
here - http://getglimpse.com/Help/Configuration.

Once this is done, as long as web forms is setting the standard http header
Glimpse is looking for -

https://github.com/Glimpse/Glimpse/blob/master/source/Glimpse.AspNet/RequestMetadata.cs#L42-L60

Everything should just work.

Let me know if this fixes your issue.

On Sun, May 26, 2013 at 2:04 AM, grahammendick notifications@github.comwrote:

Relates to the latest Glimpse.AspNet on .NET 4.5 and IIS Express.

Problem
Create an ASPX page consisting of a ScriptManager and an _UpdatePanel_containing a
Button. Clicking the button results in a partial page request but the
request information is not displayed in the Glimpse UI.

Fix?
The response, generated by .NET, from the partial page request has a
content type of "text/plain" and so its data is filtered out by the *
ContentTypeWhiteList_.
This can be fixed by adding this content type to the *
ContentTypeElementCollection_ constructor.

public ContentTypeElementCollection()
{
    BaseAdd(new ContentTypeElement { ContentType = @"text/html" });
    BaseAdd(new ContentTypeElement { ContentType = @"application/json" });
    BaseAdd(new ContentTypeElement { ContentType = @"text/plain" });
}


Reply to this email directly or view it on GitHubhttps://github.com//issues/359
.

@grahammendick
Copy link
Author

Thanks for getting back to me so quickly, that worked a treat.

In Glimpse.AspNet shouldn't this content type be added by default? In Web Forms UpdatePanels and partial page requests are pretty much the Ajax standard.
The Single Page Application mode discussion in the Glimpse dev group seems to imply that it was turned on by default?

@avanderhoorn
Copy link
Member

Its probably worth looking at whether this should be on by default or not. I wonder if @nikmd23 has any thoughts. One thing I do know is that if we didn't want to make this the default for everyone, when we bring our Web Forms package online, it could set this.

@nikmd23
Copy link
Member

nikmd23 commented Jun 27, 2013

Thanks for taking the time to figure this out @grahammendick.

While I am a little weary to make this change, I can't think of a good reason why we shouldn't.

If you'd like to submit this one line pull request, we will accept it. I'd do it myself, but I feel like I'd be robbing you of your due credit for figuring all this out.

I'll wait until July 1st before I take care of this on my own.

grahammendick added a commit to grahammendick/Glimpse that referenced this issue Jun 29, 2013
ASP.NET Ajax requests have a content type of "text/plain" and so were
filtered out by Glimpse
grahammendick added a commit to grahammendick/Glimpse that referenced this issue Jun 29, 2013
@grahammendick
Copy link
Author

Thanks for giving me the chance to make this change and congrats for such a great project.
I've created pull request #425 that incorporates this change together with associated comment and unit test updates.
I'm going to be writing a Glimpse plug in for my Navigation for ASP.NET Web Forms project and so this Issue fix will really help me out. Am I the only person still interested in Web Forms?

@avanderhoorn
Copy link
Member

On the web forms front, we are still interested and have some cool ideas for stuff that could be done. If you are interesting in helping out further with the work, let us know and we will make this happen.

@grahammendick
Copy link
Author

I am interested in helping out but I've got quite a lot going on with my own project at the moment. Perhaps after I've written my Navigation Web Forms Glimpse plug in I'll take you up on the offer, if it still stands.

@avanderhoorn
Copy link
Member

Definitely, the door is always open. Let us know how you get on.

@ghost ghost assigned avanderhoorn Jul 3, 2013
avanderhoorn added a commit that referenced this issue Jul 3, 2013
ASP.NET Ajax requests not displayed (Issue #359)
CGijbels pushed a commit that referenced this issue Jul 14, 2013
ASP.NET Ajax requests have a content type of "text/plain" and so were
filtered out by Glimpse
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants