I have a multi-layered answer to this, which I will unpack in parts.
First, I want a definition for "fanfiction". I am going to start with the broadest possible definition:
Fiction created by one party using the characters and/or setting of another creator.
This is a definition that encompasses not merely Harry/Snape slashfic and Mary Sue seducing Aragorn, but Star Wars novels, shared-world stories, RPG tie-ins, remakes of Godzilla, and, indeed, probably 90%+ of all television (since most TV series are written by multiple different screenwriters, often none of whom created the original characters or premise), plus the vast majority of DC and Marvel comic book titles.
When I was younger, I had a tremendous disdain for this kind of fiction. I refused to read Star Trek novels. I insisted on setting my RP campaigns in worlds of my own devising. I scorned running modules. I certainly didn't write fanfiction.
Of course, I had the kind of Mary-Sue-esque self-insert daydreams that so many fanfic writers use. By the time I was twelve or so, I'd created a whole stable of original characters who wreaked havoc in the plots and among the characters of the novels I read. But I never wrote any of that down; it seemed like a waste of effort to write about someone else's characters, where I didn't own the copyright and couldn't make any money off of it. Mind you, I couldn't make any money off of my own original creations, either, but my adolescent self was oblivious to this truth. At 12, I thought far more highly of what I could write then than I think today of what I can write now.
It wasn't until I got much older that I started to mellow out. I realized that some authors do great work with characters that they didn't create. Alan Moore's run of "Swamp Thing" is excellent, making some of the dumbest B-list superheroes and villains into interesting figures. I enjoyed the first several books of "Wild Cards" even though the authors were generally writing in someone else's setting using some characters they hadn't invented. And ... I'm sure I could come up with some film and TV examples here, too, if I worked at it, but I generally haven't paid as much attention to visual media as a whole, and even less to who was writing which bits.
I came to realize* that my games were never going to result in publishable stories; in 2004, I started running a game based on Zelazny's A Night in the Lonesome October. Last year, I started running a game in World Tree -- the first time I ever used a published setting. I even used the provided starting city!
* My conscious mind realizes it, anyway. I think my subconscious is still hoping.
So, on the one hand; at this point in my life, I don't think that writing someone else's characters or setting means that the result will necessarily be inferior to what the same author would have done with his or her own.
On the other hand, in my choices of what I actually read, I'm still biased in favor of authors who write about their own characters in their own settings. This bias is less pronounced in my film and TV choices, though perhaps that's because sequels and franchises are far more common in those media. Also, scriptwriters are overshadowed by actors, directors, and producers; it's often hard to tell who counts as the "creator". And I don't know if my bias against derivative works has any basis in my actual relative enjoyment of them.
Possibly my comparative lack of interest in derivative works is that I'm not that attached to particular characters or settings these days. I tend to prefer stories that wrap up in several hundred pages or so, and I find reading story after story after story about the same protagonist is often ... tedious. Or strains credulity. After you've saved the world a couple of times, what's left? I mean, really. Give the guy a rest already.
Okay, I wanted to blather on about the narrower and more common definition of fanfic too, sooo:
Fiction by one party using the characters and/or setting of another, without explicit legal authorization
I talked about the first category initially, because the difference between "any derivative work" and "unauthorized derivative work" isn't that huge to me. On the quality front: sure, unauthorized works tend to be lower quality than authorized, but in much the same sense that the slush pile tends to be lower quality than what gets published. I'm not going to heap scorn on unauthorized fanfic only because it hasn't been authorized yet. And sure, lots of fanfic is unpublishable drek. I've written hundreds of thousands of words of original fiction that is also unpublishable drek. Who am I to criticize?
On the ethical front: I do think that the author's wishes should be respected. If an author doesn't want anyone else writing about his characters or his world, fans should respect that and not write it. Or at least not show it anywhere that the original author can see it; I don't think writing it for your own entertainment and showing it to your friends is particularly egregious. Publishing it to the web is not appropriate. Sending it to the author and then suing the author when he publishes his next book because you think he stole one of your ideas is JUST WRONG.
Other than that, I don't much care. Reading and writing fanfic isn't my thing, but neither is playing baseball, concert-going, gardening, cooking, or any of dozens of other hobbies that lots of other people love. As long as the original creator's not complaining about people writing fanfic of his work, it seems like a perfectly reasonable sort of hobby to me.