Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 20th, 2003, 04:09 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default need help a.s.a.p

i want to ask about asp.net
how to upload a picture and save the file in wwwroot directory?
and save it to the sqlserver but not the file just the name of the file (ex:mypicture.gif)

need help for my final thesis..

thank you very much

Reply With Quote
  #2 (permalink)  
Old November 20th, 2003, 05:58 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

If it's for a thesis, how about you do a little research yourself? IMO, you get smarter from learning than from copying.... ;)

If you search the Web, you'll come across lots of examples on how to upload a file and save it to disk. There is an ASP upload control, so simply check the Visual Studio documentation for information how to use this control.

Take a look at this code snippet that shows you how to save a file to the database.

Alternatively, you could write an argumentation why it could be bad practice to save file in a database. The are tons of discussions about this subject, so for an original twist in your thesis, you could come up with a discussion instead of a copied and pasted code example..... ;)

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old November 20th, 2003, 01:44 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for ur help...
actually i'm not try copy the program..i already search how to upload but i couldn't find it
by the way i'm using ms. visual studio.net so i don't understand html or write a code in notepad...
hua...care to help me again?
Reply With Quote
  #4 (permalink)  
Old November 20th, 2003, 06:08 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Where exactly did you search? Personally, I prefer Google for this. Type in a few keywords and off you go:

http://www.google.com/search?hl=en&i...et+upload+file

Takes you to:

http://forums.devshed.com/t91740/s.html
and
http://www.codetoad.com/asp.net_multiplefileupload.asp
and
http://www.codeproject.com/aspnet/fileupload.asp
and
http://authors.aspalliance.com/das/t...ileupload.aspx
and
wait, once again, I am sure you get the idea.

Cheers,

Imar

Oh, and by the way: even if you let Visual Studio do the coding for you. I would pick up a book on HTML. It's much easier to use VS.NET when you know what it does for you, and it will also help you correct the numerous errors that VS.NET introduces in your code.

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old November 20th, 2003, 11:57 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i already serach at google..but i don't know the keyword..

i'm only type asp.net..and then so many links come up..that make
me confuse

thanks a lot for the links ok..i check it up soon

i think i should learn mora about html..don'y u think it already late to study it?i concentrate at asp.net know (new tech)

beside..u don't have much time to study html coz know i'm already take my final thesis that the deadline will come soon, maybe 3 weeks from now..:(

crazy..i only study asp.net or web programming just a fwe weeks ago..
so i don't know much about web programming, may i ask u about anything again in the future?

o by the way...i want to ask about books tha u think is good(maybe vary good) to study asp.net that u think can make me understand about web programming..

sorry for my bad english..i don't speak english frequent :)

cu soon
Reply With Quote
  #6 (permalink)  
Old November 21st, 2003, 04:15 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Well, yeah, you should learn HTML even if you learn ASP.NET.

ASP.NET is a server-side technology, so it runs at the server. At the end of each page processing cycle, a bunch of HTML is send to the client browser. After all, browsers still understand just HTML; although Microsoft invented .NET, it doesn't mean that now all browsers are .NET enabled.

So, to create good looking and interactive pages in ASP.NET (or in any server-side technology), it's necessary to know a thing or two about XHTML, CSS and JavaScript.

To find out what keywords you need to search for at Google, just look at your own question:
Quote:
quote:I want to ask about asp.net
how to upload a picture and save the file in wwwroot directory
Keywords here are: ASP.NET, upload, picture, save, file

If you search for those, Google will give enough results to get you started.

For a book about ASP.NET, take a look at this book:
http://www.wrox.com/books/0764543695.shtml

or look at any of the other .NET books on this list:
http://www.wrox.com/misc-pages/booklist.shtml

I suggest you use Amazon.com to read some reviews and ratings and see which of those books is suitable for you.

No problem about your English; I can perfectly understand what you're saying. If you have any other questions, feel free to post them to this forum.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #7 (permalink)  
Old November 21st, 2003, 12:48 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if i don't post it to this forum..can i directly email u?so i don't have to check to this forum again coz it makes me open more internet form :)

if can't,that's alright :)
another question :)

if i'm going to make login function..i must check id and password entered against dbase right?
and if user give right id and pass...i want to retrieve username..

the question r, should i take the username to session ID or formauthentication.setauth(if i'm not mistake)?

i'm still confuse about formauthentication.setauth..can i retrieve the value of it for recognition to tell me that user has been login succesfully like in session?
how?

thanks again :)
Reply With Quote
  #8 (permalink)  
Old November 21st, 2003, 01:01 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

I think the easiest thing to do is to post message here, and not to my directly. This way, other people can see your question and reply to it as well.

Once you have validated your user, use the following code to set the authentication ticket:
Code:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
    1,
    TheMemberName,
    System.DateTime.Now,
    System.DateTime.Now.AddMinutes(30),
    true,
    SomeUniqueInfoboutTheUser,
    FormsAuthentication.FormsCookiePath);

// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);

// Create the cookie and set expiration.
HttpCookie authCookie;
authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
authCookie.Expires = DateTime.Now.AddDays(30);

Response.Cookies.Add(authCookie);

// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectUrl(MemberName, true));
There are many other ways to do this, so I suggest you check out the Quick Starts from the .NET SDK.

To see whether the user is logged on or not, use code from this snippet: http://imar.spaanjaars.com/QuickDocI...QUICKDOCID=148

HtH,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #9 (permalink)  
Old November 21st, 2003, 01:08 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i try the link..but i can't open it..
Reply With Quote
  #10 (permalink)  
Old November 21st, 2003, 01:16 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

My bad. It was a local URL. Fixed it now.

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 09:17 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.