|
I assume he did think about it for a second and thought that he would always recognize the situation and correct for it. That's the lazy way out in my opinion.
Phil
|
|
|
|
|
After all, does he have to support it? Probably not
|
|
|
|
|
(DOWNLOAD Book)link where would u make it.
DOWNLOAD Book
a href="dnload.aspx?filebook=../pdf/book.pdf dnload.aspx
string strRequest = Request.QueryString["filebook"];
if (strRequest != "")
{
string path = Server.MapPath(strRequest);
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists == true)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + filebook.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(filebook.FullName);
Response.End();
}
else
{
Response.Write("This file does not exist.");
}
}
else
{
Response.Write("Please provide a file to download.");
}
Pavan Pareta
|
|
|
|
|
It does not sound logical. One can just entrap querystring and then manually build the path, defeat the download statistics routine or an optional logon check.
You should pass some ID and read the file on serverside and stream it. The file should be away from virtual folder.
|
|
|
|
|
Hi,
Someone I know, new to C, made this slight error, not very big .... but funny.
char myStr[] = ``just testing'';
And I quote from the 10 commandments of C:
Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
As demonstrated by the deeds of the Great Worm, a consequence of this commandment is that robust production software should never make use of gets(), for it is truly a tool of the Devil. Thy interfaces should always inform thy servants of the bounds of thy arrays, and servants who spurn such advice or quietly fail to follow it should be dispatched forthwith to the Land Of Rm, where they can do no further harm to thee.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
And here I thought you were talking about using the two single quotes (`` ) at the start of the string instead of a single double quote (" ) as the WTF, but then you go and use the same WTF in your comments.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Obviously used to using LaTeX, doesn't it use something like that format for quotes?
|
|
|
|
|
Aren't those ASCII 96s, not ASCII 39s? That's what I thought the WTF was.
|
|
|
|
|
I don't get it, what is wrong here (except for the weird quotes)
|
|
|
|
|
Actually, I don’t get it either and I have about 20 years C programming experience.
The code shown would generate errors at compile time – simple to fix.
If the code where typed correctly, then what would bounds have to do with it?
I usually use a pointer to constant string for such strings, but if I wrote it like that I would type:
const char myStr[] = "just testing";
Without seeing the context in which it is used, that’s all I can see.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Well I'm glad that I'm not the only one who can't see it. I wonder if he meant to have an array size in the char[] declaration? The only other thing that I can think is that he is reusing this variable elsewhere, and that's where the error is (i.e. the point where the bounds checking would come into play).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Programm3r wrote: made this slight error
Where
.net is a box of never ending treasures, every day I get find another gem.
|
|
|
|
|
A possible problem with the code is that the programmer seemed to be sizing the array in a very arbitrary way. Unless of course "This is a test" is the max intended size of the array and the rest of the code isn't going over the array size.
Plus it forces every programmer who looks at the code to start counting on his fingers, getting to 10 and saying, "damn" before starting over because he couldn't remember if he included the space between 'this' and 'is' ;v)
|
|
|
|
|
Did this forum just change it's name again? WTF? The horrorror!
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
|
|
|
|
|
Shog9 wrote: Did this forum just change it's name again?
Yeah... was I disappointed! I thought it was going to be a forum about using code words while talking with prostitutes.
led mike
|
|
|
|
|
|
I don't know - you look away for just a minute and the Kid Sister police swarm all over the place.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Isn't it obvious? The new name describes the content more accurately, but is also more politically correct.
Oh for the days when one could call politician a politician and no one was offended by the name.
Phil
|
|
|
|
|
Yeah. We were getting too many general WTFs. I want specific, code related WTFs.
This wasn't PC motivated. This was RTFM motivated.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
My mistakes go to "subtle bugs", and all other to "coding horrors"?
|
|
|
|
|
Yep!
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
one of my team mate has written like this in c#
if (Request.QueryString["test1"] != null)
{
--- do something
}
else
{
Response.Redirect(Request.UrlReferrer.ToString(), false);
}
What the --------
-- modified at 6:24 Thursday 29th March, 2007
|
|
|
|
|
Could you please translate this for all the C++ programmers here
Alcohol, the cause of and the solution to all of life's problems - Homer J. Simpson
|
|
|
|
|
if "?test1=..." appears in the URL for this page
{
--- do something
}
else
{
send a request back to the client to get their browser
to re-request this page without the "?test1=..." bit on the end
} That's uuuh-gleeee
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Actually it sends them back to the page that referred them to the current page (which isn't a good idea because Norton and McAfee like to change your settings so referrer information is not passed with the request).
Request.UrlReferrer
|
|
|
|