In the 1970s sitcom, the military concert party was a motley crew – ham actors, a drag queen and tone-deaf singers accompanied on the piano by Mr "lah de dah" Gunner Graham.

The comedy It Ain't Half Hot Mum may have drawn its humour from real life, but nowadays no one in the armed forces is jeering at the entertainment on offer.

Visiting and performing for the troops has become a coveted ticket in showbiz, with cast lists heading for the front line that would not look out of place at a Royal Variety show.

Cheryl Cole, David Jason, Freddie Flintoff and Katherine Jenkins have flown to Afghanistan in the past year. David Beckham and Gary Lineker too.

The comedians who have performed there are some of the best in Britain – Ross Noble, Rhod Gilbert, Jason Manford and Lee Evans among them.

And the current forces favourite? Not an obvious pin-up, by his own admission – Radio 1 DJ Tim Westwood.

His live broadcasts from the military base at Camp Bastion have endeared him to the soldiers. So much so that they gave him a rare privilege – letting him take part in a training exercise.

The man known as the "Big Dawg" was dressed in a protective suit and set upon by the military's biggest alsatian.

"Yes, I was quite stressed about it," Westwood said. "I ended up with quite a few cuts on my arms. His teeth went through the sleeves."

That will not put him off returning, which he hopes to do at Christmas. If he makes it there, it will be his third visit this year.

Westwood, like all the A-list stars, will go there for free. He says he is planning to return because he was moved by the things he saw.

"I got quite a lot of hostility back in the UK from people who said I was supporting the war," he said.

"But that's not what this is about. There is a distinction between the people who sent them and the people who are out there doing it."

It is that distinction that has encouraged some of the UK's biggest names to fly out to a war zone when invited by either the Ministry of Defence, the charities that support the armed forces or Combined Services Entertainment (CSE) – the main organisation responsible for providing shows for British troops all over the world.

Its director, Nicky Ness, whose husband was in the military, has spent seven years challenging the It Ain't Half Hot Mum stereotype.

"After the second world war, service personnel did the entertainment themselves – Roger Moore was one of those first involved," she said.

"But in the 70s and 80s it got a certain image and we have done a massive amount of work to get away from it.

"I think we now provide five-star entertainment. We have people coming to us asking if they can go. People pitch to us all the time."

CSE puts on hundreds of shows a year, most of them in Afghanistan. The bigger shows are at the main military bases, such as Camp Bastion.

But there are also performances in Kandahar and Sangin, two of the most dangerous places in the country.

Shows can last up to two hours, with comedians, dancers and bands performing to thousands of troops.

Recently, they have become more ambitious – sending teams to perform in the more exposed, and austere, Forward Operating Bases (FoBs), which are much more vulnerable to attack.

On one occasion, says Ness, a helicopter carrying her team landed in the middle of a gun battle.

"We'll try to take two dancers and a comedian with amplifiers, a karaoke kit and a floodlight.

"It's difficult for the dancers in heels because they won't have a proper stage. There's no room for divas in Afghanistan … It's pretty difficult and demanding. The temperatures are extreme."

Westwood has not been to a FoB, but he would go if he could.

Last time he was in Afghanistan, he spent nine days at Camp Bastion, broadcasting on BFBS – the British Forces Broadcasting Service. He says that, at first, he was given a mixed reaction.

"Some of the soldiers didn't know who I was and didn't care either. And there were others who had grown up with me or knew me from [the MTV programme] Pimp My Ride."

But he made an effort to mix and ended up befriending some British troops who played dominoes.

"I spent a lot of time just hanging around with them. We'd go to one of their tents and they'd put their night vision torches on, shining red and green. And I was doing the music … it was like being in a club."

Back in the UK, Westwood, 53, has kept in contact with some of those he met and has made private visits to Headley Court, the rehabilitation hospital for the most severely injured.

"I think it is easy to forget how difficult a job they are doing. They are putting their lives on the line, they are taking great risks.

"It's nothing for me to show them some love and appreciation."

At the front line

Only experienced performers go to the smaller shows, which take place near the front line.

Dancer Naomi Lynch, 28, who is a CSE regular, said: "We live like the military for the time we spend there.

"One base we went to had a cement mixer as a washing machine … and our stage was made out of sandbags."

She was in the party that arrived at one camp during a gun battle with the Taliban.

"They were particularly busy that day. It was straight back out on the ground for them when we'd finished."

Charlotte Chapman, 27, added: "We fly in by helicopter at 8am and stay until 11pm, so we are with them all day and they show us around. That's just as important to them.

"At one of the camps, they'd had a really hard time. They were like, 'What the hell are you doing here?'.

"They were amazed we'd turned up. The soldiers behave themselves. We always get a lot of cheering and applause and that's it."