Monday, November 21, 2005
Wednesday, November 16, 2005
Getting username in ASP .Net 2.0
If you need to get the username in the code behind page use membership.getuser.username
simple once you know the answer.
simple once you know the answer.
Monday, November 14, 2005
Thursday, November 10, 2005
Wednesday, November 09, 2005
Uploading a file
1. Create your folder for uploads with the appropriate permissions
2. In form tag add this:
enctype="multipart/form-data"
3. And the input:
<input id="file1" type="file" name="file1" runat="server">
4. Add the submit
<input id="Submit1" type="submit" value="upload" runat="Server">
5. modify the submit code:
if not file1.postedfile is nothing and file1.postedfile.contentlength > 0 then
dim fn as string = (file1.postedfile.filename)
dim savelocation as string = Server.MapPath("foldername") & "\" & fn
try
file1.postedfile.saveas(savelocation)
response.write("The file has been uploaded.")
Catch exc as exception
response.write("Error: " & exc.message)
end try
else
response.write("Please select a file to upload")
enf if
2. In form tag add this:
enctype="multipart/form-data"
3. And the input:
<input id="file1" type="file" name="file1" runat="server">
4. Add the submit
<input id="Submit1" type="submit" value="upload" runat="Server">
5. modify the submit code:
if not file1.postedfile is nothing and file1.postedfile.contentlength > 0 then
dim fn as string = (file1.postedfile.filename)
dim savelocation as string = Server.MapPath("foldername") & "\" & fn
try
file1.postedfile.saveas(savelocation)
response.write("The file has been uploaded.")
Catch exc as exception
response.write("Error: " & exc.message)
end try
else
response.write("Please select a file to upload")
enf if