I have problem with external links, where users add additional characters to the end of a variable. The links should be something like "page.asp?ID=261", however I see many external links to the page with malformed additional characters, like "page.asp?ID=261FTR223". These are mostly from social networking sites.

I need to clean this up as it rresults in page errors and the variable contains both numeric and alpha, where it should only be numeric. I also only want the first set of numeric values and the rest of the variable needs to be removed.

Any help with this will be appreciated and this is resulting in way too many server errors.

Thanks
Hans

Recommended Answers

All 2 Replies

where is the source, who build that link. It not in our control if somebody refter your page like this.

Ok, so if you know what the expected character length is going to be, retreive the querystring, then use the MID function to retreive the portion of the string you are interested in.

Mid(string,start[,length])

For example...

dim qs
qs = Request.QueryString("ID")
dim str
str = mid(qs,1,3)
Response.Write(str)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.