|
Hello all. I'm using the asp:FileUpload control to, well, upload a file. I get the data and save it into a local database as a binary. It all works well.
However, I'm having a problem with the Content Type. When selecting a Word document, its content type (FileUpload.PostedFile.ContentType) is "application/octet-stream" rather than "application/msword". This will make my app not behave as expected when the document is retrieved (since I can't state a correct content type so that the document is opened by Word).
The client machine has Word installed, but the server doesn't. Do I have to install Word in the server? I was reading that the Content Type is taken from the client machine, so this shouldn't be a problem. I'm I missing something here? The MSDN documentation doesn't say a thing about the content type.
Thanks in advance.
Stupidity is an International Association - Enrique Jardiel Poncela
Die deutsche Sprache sollte sanft und ehrfurchtsvoll zu den toten Sprachen abgelegt werden, denn nur die Toten haben die Zeit, diese Sprache zu lernen. - Mark Twain
|
|
|
|
|
The asp control is just an input type=file, b/c that's the *only* way that a file can be uploaded from a browser using HTML. I'd suggest you need to work out it's a Word doc from the file extension.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I was thinking the same. However, it wouldn't work for non-common extensions (for instance, there's an app that has its own extension, and so on). If I don't find a better way, I'll have to do it this way.
Thanks for the answer.
Stupidity is an International Association - Enrique Jardiel Poncela
Die deutsche Sprache sollte sanft und ehrfurchtsvoll zu den toten Sprachen abgelegt werden, denn nur die Toten haben die Zeit, diese Sprache zu lernen. - Mark Twain
|
|
|
|
|
What are you trying to do with the file once it's uploaded to your server?
Todd Smith
|
|
|
|
|
It's some sort of document flow, so I store it in a database and many users have to approve/reject it. I need the content type so I can show it to the user by simply writing the binary to the HttpResponse object. I guess I'll have to try something different (Christian's suggestion, most likely).
Thanks.
Stupidity is an International Association - Enrique Jardiel Poncela
Die deutsche Sprache sollte sanft und ehrfurchtsvoll zu den toten Sprachen abgelegt werden, denn nur die Toten haben die Zeit, diese Sprache zu lernen. - Mark Twain
|
|
|
|
|
Can anyone please suggest a few free mail clients library supporting SMTP & POP. written for C# ASP.Net projects?
|
|
|
|
|
How to maintain Seesion in windows application
Rickey
|
|
|
|
|
Windows applications are stateful, therefore there is no need to explicitly store session state like there is in an ASP.NET application (which is stateless).
|
|
|
|
|
I want that if User is not using the application for 20 minutes then he hase to login again.
Rickey
|
|
|
|
|
As he explained that Windows Apps are stateless and does not maintain session, you will need to write custom code for it.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Then you'll have to write some sort of custom logic for that. You could create a class that maintains a "last used" timestamp. Each time your user does something, event calls a method in the class that updates the timestamp. If the method detects that the time now is greater than 20 minutes since the last time, it can initiate the login form - Your application would then be unusable until the user has logged in.
|
|
|
|
|
Hi,
What is the best encryption for saving password in DB?
I need a encryption that can be decrypt it (access real password).
Could you tell me how do it (the encryption thah you'll introduced), please?
Best wishes
|
|
|
|
|
|
use RIJNDAEL...
Its most popular and also good one..
Abhishek Sur
|
|
|
|
|
|
mehrdadc48 wrote: I need a encryption that can be decrypt it (access real password).
That's less secure. For better security you have to use hashing with salt added. Check SHA512Managed or SHA384Managed classes.
|
|
|
|
|
You are better off using a secure cryptographic hash with salt values added to the original password.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have two comboboxes FooBar1 and FooBar2, both store a value retrieved from tbl_FooBar. One of the values in tbl_FooBar is 'All'. If 'All' is selected in one combobox, the value in the second must be null (displayed as 'none'). Can I enforce this using a validator?
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Why you are looking any validator.you'll have better control and flexiblility if you do it by custome code.
Cheers!!
Brij
|
|
|
|
|
My JS skills don't reach the level of dangerous, so I was hoping I'd just missed an option to do it the easy way.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
OK, I have a client side validator function that does the check. I still have problems though. I need to set/clear the error on both FooBar1 and FooBar2 every time the value is changed on either. I've spent about 15m playing around with putting copies of the CustomValidator in the templates for FooBar1/2 and having them validate either the Combobox they're in, or the alternate one without success.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hi i have searched about report viewer in google...,
I got lot of solutions...,
But nothing is satisfied my requirments...,
So i am just posting here....,
In runtime only i said which query have to execute...,
So based on that its giving the datas...,
So i cant create any object(xsd file) and assign in to my chart control(rdlc component)...,
Then how to create a chart control and my datas in that...,
Give m,e some ideas abt this,
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
please anyone give me some idea in such a way as a result i can do in place edit and update row in gridview by ICallBack ajax in asp.net v2.0 becoz i searched lot google for getting some idea to implement gridview in place edit and update.i will be highly obliged if someone give me code snippet or idea to do this.
tbhattacharjee
|
|
|
|
|
How can i hide the Query String Variables from the URL?
Example:
www.ABC.com/?ID=invitations -- BAD URL
www.ABC.com/invitations -- GOOD URL
|
|
|
|
|
use the session, a table in the db that only holds data long enough for the page to change i.e. one page adds it the next removes it, you could put the whole site in a frameset from the begining so that the user will only see www.abc.com and the frameset redirects to your first page.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|