Get Username of a domain user
How can I get the domain, username and PC network name (Win 2000 Pro & Win
XP Pro PC's) of the current logged on user (logged onto a domain and access
an intranet page, Window 2000 server running IIS) and put this automatically
in a textbox in an webpage. Can this be done with asp & VB?
I basically want to automatically populate a username field with the users
logon so the do not need to type it themselves, leading to type errors.
Thanks,
Jach Tag: Crawl a site Tag: 295601
How? Send Same Email as HTML *or* Plain Text
Hello. I'm looking for a simple way to do the following:
We have a database that serves-up content to a website. Some of those items
are events, some are news articles. They're stored in the DB as formatted
HTML so ASP just drops them right into a page shell.
Now, we want to send out a newsletter email containing some of those items.
No problem sending as HTML. However, some of the members want just plain
text. Is there some magic method in CDO that can automatically convert HTML
to plain text? Or, is there some existing VBScript code out there that can
do this?
BTW, the environment is IIS 5.x (Windows 2000), Classic ASP, and CDO.
Thanks... Tag: Crawl a site Tag: 295595
What's wrong with this?
Hi all,
I've got this snippet which is not working:
<%
Dim tDATA
Dim oConn
Call Connect(oConn, "")
Set tDATA = Server.CreateObject("ADODB.Recordset")
tDATA.Open "SELECT * FROM MyTable WHERE id = " &
CLng(Request.QueryString("id")), oConn
With tDATA
If Not tDATA.EOF%>
<p><strong><%=tDATA("name")%></strong><br />
</p>
<font size="-1" face="Verdana, Arial, Helvetica,
sans-serif"><%=tDATA("text")%>
<%End If
tDATA.Close
Set tDATA = Nothing
%>
</font>
Can anyone see the problem??
Thanks,
Ivan Tag: Crawl a site Tag: 295587
PostField and Variable names
Hi,
I am new to ASP and I cannot figure out how to pass variable content in
ASP.
How to pass the variable sClientNo in the following redirect.
Response.Redirect("AccessDenied.asp?ClientNo=sClientNo")
thank you in advance
serge Tag: Crawl a site Tag: 295586
Aspx return system.drawing.image
Hi,
I have aspx page, and this page go to another aspx i have that this second aspx return a image, how the first page can received the object system.drawing.image.
My code is that:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Response.Buffer = True
Dim lImage As System.Drawing.Image
lImage.FromFile(Request("Path"))
Response.End()
End Sub
It's OK???
And how I can view the image in the first page??
Thanks
Silvia Tag: Crawl a site Tag: 295584
Silvia
Hi,
I have aspx page, and this page go to another aspx i have that this second aspx return a image, how the first page can received the object system.drawing.image.
My code is that:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Response.Buffer = True
Dim lImage As System.Drawing.Image
lImage.FromFile(Request("Path"))
Response.End()
End Sub
It's OK???
And how I can view the image in the first page??
Thanks
Silvia Tag: Crawl a site Tag: 295583
Caching images & ASP pages
I've had some periodic problems on certain (intranet)servers where IIS seems
to be caching thing in an unexpected way, or is server cached pages where
new content is expected.
The first situation is where we have a standard Top + Left + Content
framset; the left frame contains a menu which shows standard options - when
the user logs in, extra menu options are available to them, depending on
their priveleges. The menu is generated from a DB in ASP, and when the user
logs in, Javascript is used to reload the page in the left frame - eg.
re-generate menu based on logged-in user.
This used to work on all servers, but at some point in time I found that
people were logging in but were stuck with the standard menu. If we
right-clicked in the menu and chose refresh, often the correct (eg expanded)
menu would be shown.
I'm not sure where the problem is IIS or could be controlled in ASP...
The second problem is on my development machine; when I browse to my
development copy of the intranet, I dont get the icons for each menu item.
However, when I browse to the live Intranet system, the correct graphics are
shown.
Screenshots:
My machine - http://www.brightnorth.com/news/menu1.gif
Normal site - http://www.brightnorth.com/news/menu2.gif
I'm assuming that this one is purely an IIS problem. Any thoughts? Tag: Crawl a site Tag: 295579
Session.LCID?
We are translating our web shop to Slovak but when I use Session.LCID=1051
for slovak do I get the error "Invalid LCID". The same shope use Swedish =
1053, Norwegian(Bokmal) = 1044, English = 1033 and no problems.
What do I have to do in order to get Slovak to work on the same server?
Regards,
Hagge Tag: Crawl a site Tag: 295578
attribute value in a html button
The code
<input type="button" name="btn" value="ok">
will produce a html button with caption ok and value ok.
The problem is the width of button is dependent on the length of
attribute value.
And I do the following, which is not a good solution.
<input type="button" name="btn" value=" ok ">
The problem is if I want to get the button's value:
Request.Form("btn"), then I need to trim the data.
any ideas?? Tag: Crawl a site Tag: 295568
Problem with Radio Buttons
I have a form with a single named multiple valued radio button, as it should
be, i have got an error for 2nd time on my site, the error shows that the
value of radio button submitted is multiple i.e. "17, 18", i can't figure it
out how, there is no problem in the code. it has just one INPUT field for
this variable..... ? Tag: Crawl a site Tag: 295566
reference the document object?
Is it possible to reference a Web page title
(Document.Title) in an asp page? For example,
<% Document.Title%> embedded in the body of an asp page?
This would allow a server side include that changes a
header at the top of the page, based on the page Title.
Thanks, Jim Tag: Crawl a site Tag: 295562
post form data to a modal dialog window
I reposted this question because I really want to accomplish this task.
Please advise!!
I want to post the form data (http://server/page1.asp) to a modal dialog
window (http://server/modaldialog.asp) with a desired height 200px by width
200px.
Here's my attempts and problems:
Attempt #1) In http://server/page1.asp, it has code <form
action="http://server/modaldialog.asp" method="post" target="_blank">
In http://server/modaldialog.asp, it has code <body onBlur = "self.focus()">
It can produce modal dialog window modaldialog.asp, but I want to set the
width and height of modaldialog.asp.
Attempt #2) var sReturn = window.showModalDialog("modaldialog.asp", params,
"dialogHeight:200px; dialogWidth:200px;");
This is the effect I want. But this is not posting the form data to
modaldialog.asp.
Any workarounds to my problems??
Thanks!! Tag: Crawl a site Tag: 295559
submit button with image question
In the following code, I have 2 questions regarding submit button with
image.
1) Does this code <input type="image" name="populate" src="populate.gif">
behave the same as an HTML submit button with image populate.gif?
When I click p1 or p2 button, it will post the page to process.asp.
2) When I check the checkbox, I want the image in submit button change
from populate.gif to validate.gif. Unfortunately, the code
InputForm.p2.src = "validate.gif"; doesn't work. But
InputForm.p1.value = "validate button"; is working for a regular HTML submit
button.
Any workarounds? Please advise. Thanks!!
<html>
<head>
<script type="text/javascript">
function cb_onClick()
{ if (InputForm.C1.checked == true) //NOT InputForm.C1.value == "on"
{
InputForm.p1.value = "validate button";
InputForm.p2.src = "validate.gif";
}
else
{
InputForm.p1.value = "populate button";
InputForm.p2.src = "populate.gif";
}
}
</script>
</head>
<body>
<form name="InputForm" method="POST" action="process.asp">
<p><input type="checkbox" name="C1" onClick="cb_onClick()"></p>
<p><input type="submit" name="p1" value="populate button">
<p><input type="image" name="p2" src="populate.gif">
</form>
</body>
</html> Tag: Crawl a site Tag: 295558
response.cookie in session_onstart event and IE 6.0 cookie acceptance
When I set a cookie in global.asa in the sub session_onstart, even if
I have "privacy" in IE 6.X set to "block all cookies" the cookie is
still set, and I can get it on other pages.
I can't find an article that addresses this as a specific issue. Why
does the browser get the cookie when it is set in the session_onstart
event even when I have "block all cookies" set? Tag: Crawl a site Tag: 295554
asp script for forms result
I am struggling to come up with a way to save a forms'
results, to a text file, but the name of the text file
comes from the input of a user name on another forms...
ex. john doe enters pg1 & enters his name in a space on
the page (form) . this links him to the next page,
pge_form. I need the results of page_form to be named
johndoe.txt
Thank you very much for any help at all... Tag: Crawl a site Tag: 295552
ASP book recommendation???
I am just starting to learn ASP and would like to pick up a good book.
I have been through ASP Programming for the Absolute Beginner and got
some ideas, but it only discussed local servers running PWS or IIS -
nothing about working with an internet ASP hosting service. It also
lacks good descriptions of syntax.
I have also looked at the O'Reilly ASP in a Nutshell, but it seems
like a reference for more advanced users, not a learning tool.
I have some Javascript background, but right now I'm trying to pick up
ASP and VBScript at the same time so a book that has an ASP/VBScript
focus would be ideal.
thanks, BDT Tag: Crawl a site Tag: 295541
help with Server.CreateObject("Scripting.FileSystemObject")
I am just beginning with asp and have gotten an error that I need some
help with. I posted a pair of files to an online ASP host server. The
files are in the same directory; one is readfile.asp which should open
the other which is a simple text file - newText.txt .
Here is readfile.asp :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Reading Text Files</title>
</head>
<body>
<b>An Example of reading a .txt file and hopefully adding some
formatting.</b>
<hr>
<%
set tfile=Server.CreateObject("Scripting.FileSystemObject")
set TFStream=tfile.OpenTextFile("newText.txt")
textprinter=TFStream.readall()
%>
<p>
<%=textprinter%>
</body>
</html>
Here is the error msg that results:
Microsoft VBScript runtime error '800a0035'
File not found
/Test-BDT/readfile.asp, line 13
Where line 13 is:
set tfile=Server.CreateObject("Scripting.FileSystemObject")
MY Qustions:
-Why didn't it work?
-How do I get it to work? (I suppost I could do a server side include,
but I'd like to figure out the how& why of this code first.
-I may have a path problem. Can someone point me to a good reference
about referencing path in this code?
thanks a lot, BDT Tag: Crawl a site Tag: 295538
Favorite Scripting shortcuts
What's your favorite bit of "short-cut" code that you use?
One of my favorite shortcuts I'll use when coding a page is to create a sub
along the lines of the following:
Sub Print(myText)
Response.Write myText & vbcrlf
End Sub
And then I use Print instead of Response.Write thru my code.
I do this for several reasons:
A) I'm an old-skool coder, and I started coding back in the days when you
wrote to the screen with "PRINT"
B) It's shorter than doing Response.Write [insert string here] & vbcrlf for
every instance where you want to write to the client.
C) It's easier to use for debug purposes: If for example I want to do a
time-trace to see where a slow-down is occuring, I'll change the code to
Response.Write "<!--" & Now() & "-->" & myText
D) If I want to adapt a particular snippet of code for client-side, I'll
usually just have to copy/paste (along with minor changes), and include the
Print sub, except with Response.Write changed to Document.Write. Tag: Crawl a site Tag: 295533
ASP vs ASP.NET
Complete newbie questions!
Why use ASP instead of ASP.NET?
Why use ASP.NET instead of ASP?
I am assuming that ASP.NET has all of the "features" of ASP plus a whole lot
more, is more up to date and more future proof, so would prefer that some
work I want undertaken is written in ASP.NET. Why would a company I am
dealing with prefer to stick with standard ASP? They have said that ASP.NET
is not proven and so ASP is more reliable. They have also said that they are
more experienced with ASP than ASP.NET but wouldn't the "language" be the
same? I am a complete novice to this so would like some impartial comments
on whether I should insist they use ASP.NET.
Richard Tag: Crawl a site Tag: 295518
Calling a Block of ASP from Another
I have a block of ASP code (enclosed in <% .. %>).
How can I call that piece of code from another piece of similar code?
And can the code be in any order on the page for it to work?
Thanks Tag: Crawl a site Tag: 295516
ASP issue
Can a ASP work like a CGI.(Email Scripts) ?
Can a ASP script for email will work, if a Script is on 1 server and
form(html.form) is on another server and a thank you page is on 3rd server.
Like if u don't know about a CGI there are many websites who give you
permission to use their script by editing little bit in yours form and place
them on yours server website, there are number of site.
And 1 more thing I want to ask is if some one use a windows server he have
a form html on that server, can he run asp script which is on Linux server
to get form result on his desired email id. Tag: Crawl a site Tag: 295511
HTTP Compression - Urgent
i have activate the HTTP compression for static and
dynamic files, the problem is that iis or web browser is
caching the response of the asp page... and allways
display the same. Example:
<%
Response.Write "Time: " & Time()
%>
allways display the same time, i need to do a manually
Refresh (and that is not what i want...).
how can i fix the problem
Thanxs Tag: Crawl a site Tag: 295510
Unicode Character Problem
Hi Folks,
I am having a problem with a forms entry using Unicode characters,
specifically "smart-quotes". Under Microsoft PWS and MS-SQL 7.0 it
works fine and I get the Unicode characters, such as smart-quotes,
being written and read form the database. However, if I use the same
code using Apache, Linux and SunONE ASP the Unicode characters don't
work!
Here is an example of the pages:
http://www.oldham.gov.uk/mccall/smart.jpg
http://www.oldham.gov.uk/mccall/broke.jpg
Our developers have tried to change the character set to correct the
problem, but have been unable to get it working and its currently
using a work-around at the moment to specifically detect the
characters we want.
Can anyone suggest what the problem is, and how to correct it?
Thanks,
Andrew McCall Tag: Crawl a site Tag: 295509
HELP.. ERROR: Unable to relay for user@mail.com
Can someone please help!!
This is driving me nuts...
I keep getting the following error when I run the send mail script below. I think it might be because I don't have the smtp server configurered properly or because I have to make a change on our exchange server???
We are running IIS 5 on Win2K server and using Microsoft Exchange Server 5.5 can someone please tell me how I solve this!
Thanks
Error:
Email send failed: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for user@mail.com
<%
mailComp = "CDOSYS"
smtpServer = "SMTP01"
fromAddr = "user@mail.com"
if mailComp = "CDOSYS" then
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.From = fromAddr
cdoMessage.ReplyTo = replyTo
cdoMessage.To = recipients
cdoMessage.Subject = subject
cdoMessage.HtmlBody = body
on error resume next
cdoMessage.Send
if Err.Number <> 0 then
SendMail = "Email send failed: " & Err.Description & "."
end if
set cdoMessage = Nothing
set cdoConfig = Nothing
exit function
end if
%> Tag: Crawl a site Tag: 295506
how to check user account and password in another domain controller?
By using <authentication mode="Forms" > in web.config, we can create
self-designed login page, but how to check user's account and password is
vaild in another domain controller?
Does <authentication mode="Windows"> can have self-designed login page? Tag: Crawl a site Tag: 295505
cannot find .net framework directory: system error &H80131700&
Hi Guys,
I have installed Visual Studio.Net on my windows XP
machine.
First after installing all the required WCU, then
installed the Visual Studio.Net. All set up was completed
successfully. then when i try to create a Web Application
i get the error
"project 'ABC' could not be opened because the microsoft
visual basic .net compiler could not be created. please
re-install visual studio"
So i uninstall the entire setup and reinstall it again.
Now i get the error:
"project 'webapplication4' could not be opened because
the microsoft visual basic .net compiler could not be
created. cannot find .net framework directory: system
error &H80131700&"
Can you please assist with this and let me know how i
need to proceed further for a successful installation of
Visual Studio.Net 2003.
Appreciate your help on this!
Thanks,
Vamsi. Tag: Crawl a site Tag: 295504
Simple Insert into Table?
Can anyone give me some simple sample code to insert a value from a session
variable into a table in a SQL DB.
I am using Dreamweaver MX04 and this works fine with their built in
procedures, but I need to modify one to do dual inserts and I am not
knowledgeable enough to modify the code. Tag: Crawl a site Tag: 295503
Pages are not refreshed on client machines
Hi all
I have a web site where I use cookies to navigate between
the pages. The cookie is his id no which is nothing but
his staff id no. All most all pages are dynamic and
connected to sql server 2000 through ADOs. My problem is :
if any one logs in and enter bowse the pages and goes back
uses other log in his old page is displaced rather than
new one, untill he explicity uses the refresh button. Once
he does that , it is working. Iam using javascript menus
to navigate between pages.Previously when menus are not
there pages were working fine.
Now I would like to to see that the cached pages expire
after he comes out of page . how to do that.
Thank u so much in advance
R.D.CHETTY Tag: Crawl a site Tag: 295499
Is it possible to change the request order of fields on a form?
For an auto-generated form I have the following order of fields:
savevalues
userid
productcode
PrintColour1_1 Colour1_1 Quantity_1
" " " "
" " " "
PrintColour1_5 Colour1_5 Quantity_5
I was hoping to get them from the request object by rows, but they come
out as the following (example values included):
savevalues = yes
userid = 4029
productcode = 46BN
PrintColour1_1 = Black
PrintColour1_2 =
PrintColour1_3 =
PrintColour1_4 =
PrintColour1_5 =
Colour1_1 = Red
Colour1_2 =
Colour1_3 =
Colour1_4 =
Colour1_5 =
Quantity_1 = 5
Quantity_2 =
Quantity_3 =
Quantity_4 =
Quantity_5 =
Is there any way of changing this order as I think it may make it easier
to process the fields (which can change according to what the original
form fields are.)
Thanks.
--
GIT Groupie : http://gitgroupie.timchuma.com
The Twits Give Me the Shits : http://twitsgivemetheshits.timchuma.com
My Photos : http://photos.timchuma.com
Hong Kong Movie Reviews: http://hkmovies.timchuma.com Tag: Crawl a site Tag: 295488
ASP and session object (get type)
I would like to be able to get the type of object that a session variable
contains (for example, determine whether it is a string, integer, single
precision floating point, ADODB.Recordset, etc...)
I need to know this for a ASP <----> ASP.NET session management script I am
writing. I would like to be able just to copy strings and numbers. I
already have code that does this, but I don't want my script to blow up when
it finds a recordset in the session object!
Is there any easy way to detect the object type in ASP? Tag: Crawl a site Tag: 295477
session variable inconsistency
Hi,
I am experiencing a problem with recalling a session variable which stores
whether a person is logged in to a "members only" section of a website. This
area of the site has been working flawlessly for a couple of years under
Windows 2000 server but now is very inconsistent following a recent upgrade
to Windows server 2003. Following a login, the login info is passed to this
asp page that checks an Access database for the user name and password:
SET DbObject = Server.CreateObject ("ADODB.Connection")
DbObject.Open "DSN=pseudoCAP1;UID=;PWD="
set rs = server.createobject("adodb.recordset")
SET Rs = DbObject.Execute (SQL)
If Rs.EOF Then
Session("Authenticated") = 0
Response.Redirect ("unsuccessfulLogin.htm")
Else
Session("Authenticated") = 1
Session("user") = Request.Form("username")
End If
rs.close
set rs = nothing
DbObject.Close
set DbObject = nothing
response.redirect "main.asp"
If a correct password and username is provided, the user is always forwarded
to the main.asp member start page. I included a snippet of code while
troubleshooting to print the value of the authentication session variable
in the browser window to see if it was set (1=logged in, 0= not logged in).
However about 50% of the time, the following error occurs with our access
database and Authentication session variable is output as = 0:
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
C:\INETPUB\WWWROOT\SUBMISSIONS\../include/functions.inc, line 4
The way that this page is written though, even if the record was not present
(although it is when I open the database), the authentication should still
be set to 1. Refreshing the main.asp page will often eliminate the ADODB
error above and the session variable value of 1 will be returned.
The rest of the time, authentication is OK and a value of 1 is output.
However when the user goes to another page requiring authentication, they
are redirected back to the login.html page because the authentication
variable is once again set as zero!
Could this be an IIS 6.0 specific problem (I do have session state enabled
at default value of 20 min) ??
Or could there be some permissions problem related to a specific file (I
have checked the database as well as the related files and they all seem
OK)?
Thanks,
Geoff Tag: Crawl a site Tag: 295476
Corrupt files when using SSL download and ASP 3
My company has a web application for downloading and uploading of reports in MS Office formats. The application has been working fine until we added certificate for secure transfer. Now, when the files have been uploaded and then downloaded, I get an alert saying "select the encoding that makes your document readable".
In the preview box, a line of ASP code (a line with a file include) is displayed and there after alot of squares and other unreadable characters.
I am using the SA File-up components for upload and download of files. Any ideas? This was working file until SSL was added.
Cheers,
Jens. Tag: Crawl a site Tag: 295474
website is down because of ASP code
Our web site sometime down with unknown reasons, someone
can help me? I checked application log in event viewer:
1.Error: File confirmation.asp CreateObject Exception.
The CreateObject of '(null)' caused exception C0000094.
(But I didn't use ADO recordset session variable)
2.Error: File confirmation.asp Unexpected error. A
trappable error (C000001E) occurred in an external object.
The script cannot continue running..
(But I checked VBScript.dll version it is above 5.1, it is
5.6, it should not have formatnumber race condition
problem)
any clue? Thanks Betty Tag: Crawl a site Tag: 295472
SQL Query Causing Inifinate Output
When I change the "aplink.withdrawn" to include a new field with a
similar name "aplinks.pwithdrawn,aplinks.awithdrawn", the output in the
web page is blank and un-ending. When I test this query against the
Foxpro database, it works correctly.
'Good Query
sql2="SELECT DISTINCT
aplinks.partyno,attorney.*,aplinks.party_type,aplinks.partyname,aplinks.
withdrawn FROM attorney,aplinks WHERE attorney.dktno LIKE '%" & case_no
& "%' AND aplinks.dktno LIKE '%" & case_no & "%' AND
attorney.attyno=aplinks.attyno ORDER BY aplinks.partyname ASC,
aplinks.party_type ASC, attorney.principal DESC"
' NEW Query
sql2="SELECT DISTINCT
aplinks.partyno,attorney.*,aplinks.party_type,aplinks.partyname,aplinks.
pwithdrawn,aplinks.awithdrawn FROM attorney,aplinks WHERE attorney.dktno
LIKE '%" & case_no & "%' AND aplinks.dktno LIKE '%" & case_no & "%' AND
attorney.attyno=aplinks.attyno ORDER BY aplinks.partyname ASC,
aplinks.party_type ASC, attorney.principal DESC"
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: Crawl a site Tag: 295471
Can I share Session variables across Applications?
In one Application (2) the client is redirected to a Logon ASP in a =
different Application (1). A Session Variable is made in Application 2 =
which needs to be recognized in Application 1. Can I do that in Windows =
2000 SP3 IIS5 no .NET Framework? Thanks.
--=20
George Hester
__________________________________ Tag: Crawl a site Tag: 295467
ASP Security
I am trying to prevent users from submitting HTML pages from their
local machine to our website and I was wondering what the best way of
doing this was.
I was thinking about using the HTTP_REFERER server variable (to check
where the user has submitted a page from) as a blanket fix however
when you use the javascript document.location on a page the
HTTP_REFERER is always blank, which makes that a flawed fix.
I have seen other sites protect against this, so I know it can be
done. Whats the best way.
Thanks for listening. Tag: Crawl a site Tag: 295465
OpenTextFile never return
Hi,
I cannot use the OpenTextFile method, it's never return and I get no
error message! Setting Response.Buffer=False, has no effect. No matter
if I use it ForReading or ForWriting, it never return. In the following
code, the problem occurs at line 3.
aFileName = Server.MapPath("WEB_PROD.htm")
set fs = server.CreateObject("Scripting.FileSystemObject")
set fso = fs.OpenTextFile(aFileName, ForReading, False)
s = ts.ReadAll
ts.Close
set ts = nothing
Response.Write s
any help will be appreciate.
thank you in advance
serge Tag: Crawl a site Tag: 295463
CreateObject in ASP page limit?
I've made an ASP page that use a VB6 ActiveX EXE with a CreateObject.
Initially, this page work fine.
The objectâ??s reference created with the CreateObject are saved on a session variable for reuse it on many page.
When many users call this page and many instance of the ActiveX EXE Object are created, the CreateObject command fails with a 429 error (ActiveX component can't create object).
The class (in ActiveX EXE) are MultiUse, then only a single EXE are running.
Terminating the EXE with Task Manager then the CreateObject will get to work again.
There is a limit of use with Objects created?
Any idea? Tag: Crawl a site Tag: 295458
Delete images from listview
Hi,
I have a program that capture images and put this into a listview (using imagelist), the problem is when I delete de image
the listview, when do that and capture another image, the image painting in the listview is the image delete, I supose
that the problem is that the image exist in the imagelist, in order to solve this problem I clear the imagelist and add all
the images captured, but i have another problem now, some time when I delete a image, when do IO.File.Delete(gstrPathImage & "\" & lstrFile) say that the file is be using with another process.
The code is:
Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click
Dim lIndexes As ListView.SelectedIndexCollection = ListViewImages.SelectedIndices
Dim liIndex As Integer
Dim lstrFile As String
Dim liNumSelect As Integer = lIndexes.Count
Dim i, j As Integer
Dim lstrFiles(liNumSelect - 1) As String
Dim lstrFilesRemove() As String
Dim lstrFileRemove As String
Dim liIndexRemove As Integer
i = 0
For Each liIndex In lIndexes
lstrFiles(i) = ListViewImages.Items(liIndex).Text
i = i + 1
Next
For i = 0 To lstrFiles.Length - 1
For j = 0 To ListViewImages.Items.Count
If lstrFiles(i) = ListViewImages.Items(j).Text Then
lstrFile = ListViewImages.Items(j).Text
ListViewImages.Items(j).Remove()
IO.File.Delete(gstrPathImages & "\" & lstrFile)
IO.File.Delete(gstrPathImages & "\" & Microsoft.VisualBasic.Left(lstrFile, Len(lstrFile) - 4) & ".raw")
ImageList.Images.Clear()
liIndexRemove = 0
lstrFilesRemove = IO.Directory.GetFiles(gstrPathImages, "*.BMP")
Dim lImage As System.Drawing.Image
For Each lstrFileRemove In lstrFilesRemove
lImage = lImage.FromFile(lstrFileRemove)
ImageList.Images.Add(lImage)
liIndexRemove = liIndexRemove + 1
Next
lImage.Dispose()
lImage = Nothing
Exit For
End If
Next
Next
end sub
Anybody know that is the problem??
Thanks
Silvia Tag: Crawl a site Tag: 295456
Russian in ASP pages?
Hi all,
I would like to create a site which shows text in English or in Russian
(depending on the user's choice).
Problem is that I can't save the pages in Unicode (Unicode can contain
Russian characters), because IIS can't handle Unicode ASP pages (correct,
right?!).
So how can I have normal (ASCII) ASP pages, which can show either text in
English or Russian (charset Windows-1251)???
Thanks!
Greetings, Steven Tag: Crawl a site Tag: 295453
adding values from a submitted form
HI There,
I am trying to total the value of some form fields I am referecing the form
field with an inner loop, I am having a little trouble because the amount of
fields returned is always different, how can I roll-up the total of the form
fields (request.form("subtotal_"& i)) to get one final figure?
Sean - Thanks in advance for your answer
for i = 1 to Request.Form.Count
if request.form("quantity_"& i) <> "" AND request.form("quantity_"& i) <>
"0" then
!-- inner loop
dim j
dim thetotalof
for j = 1 to request.form("subtotal_"& i).count
thetotalof = request.form("subtotal_"& i)
response.Write thetotalof
next
!-- finish inner loop
thecounter = thecounter + 1
response.Write "<tr><td>" & trim(stripQuotes(request.form("productid_"&
i))) & "<input type=hidden name=productid_" &
thecounter & " value='" & trim(stripQuotes(request.form("productid_"& i))) &
"'></td><td>" &
trim(stripQuotes(request.form("quantity_"& i))) & "<input type='hidden'
name=quantity_" & thecounter & " value='" &
trim(stripQuotes(request.form("quantity_"& i))) & "'></td><td>" &
Application ("defaultcurrency") & " " &
FormatNumberVal(trim(stripQuotes(request.form("subtotal_"& i)))) & "<input
type='hidden' name=subtotal_" & thecounter & "
value='" & trim(stripQuotes(request.form("subtotal_"& i))) & "'></td></tr>"
end if
next Tag: Crawl a site Tag: 295450
ASP problem with includes
When I use an include file like this
<!--#include file="..\..\cfig.asp"-->
<!--#include file="..\..\clsOOPModule.asp"-->
my server gives an error of :
Active Server Pages error 'ASP 0131'
Disallowed Parent Path
/test/module/VieBoard/main.asp, line 1
The Include file '..\..\cfig.asp' cannot contain '..' to
indicate the parent directory. Tag: Crawl a site Tag: 295444
Reading Form values into a Scripting.Dictionary
I have been trying to read values from a form into an array on a page
without much success and was told to use a Scripting.Dictionary instead.
There are a variable number of fields on the form as it is different
according to which product is ordered (as are the fields that are used to
create the record.)
This is my first attempt:
set OrderInfo = Server.CreateObject("scripting.dictionary")
set OrderInfo("prodid") = Server.CreateObject("scripting.dictionary")
set OrderInfo("userid") = Server.CreateObject("scripting.dictionary")
OrderInfo("prodid") = lngProductID
OrderInfo("userid") = lngUID
For each x in Request.Form
set OrderInfo("prodid")("userid")(x) = Server.CreateObject
("scripting.dictionary")
OrderInfo("prodid")("userid")(x) = Request.Form(x)
Next
For each x in OrderInfo("prodid")("userid")
Response.Write x & " = " & OrderInfo("prodid")("userid")(x) & "<BR>" &
vbcrlf
Next
Thanks.
--
GIT Groupie : http://gitgroupie.timchuma.com
The Twits Give Me the Shits : http://twitsgivemetheshits.timchuma.com
My Photos : http://photos.timchuma.com
Hong Kong Movie Reviews: http://hkmovies.timchuma.com Tag: Crawl a site Tag: 295443
HTTP 500.100 I don't know anymore
Hi
I really don't know anymore how to solve this problem. I bought .NET
thinking i can debug my way out of it but still no cigar.
This very simple piece of code does not work:
Now here some things before looking at the code:
1. In .NET and IE and IIS I've set all possible debugging options
2. I've set a watch at the beginning of this page, so that when .NET
enters this page I can step the program
3. If I have the line: set test = cnn.Execute("INSERT INTO comments
('ghj', 'comment', 67)) in this code then .NET does not even let me step
throught the program. It just immediatly give the error below.
4. If I have the line: cnn.Execute("INSERT INTO comments ('ghj',
'comment', 67)) in this code then .NET does not even let me step throught
the program. It just immediatly give the error below.
5. I know I should not use c:\events.mdb but this was only a test.
6. with the cnn.Execute line ommited, the thing steps through the code
but ofcourse does not work.
7. I know I can use the long way getting the data in the database, but
damit I want to do it this way!
<code>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>myweb</title>
</head>
<body>
<%
Dim cnn
Dim strDBPath
dim test
Set cnn = Server.CreateObject("ADODB.Connection")
strDBPath = "c:\events.mdb"
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
strDBPath & ";"
cnn.Open
set test = cnn.Execute("INSERT INTO comments ('ghj', 'comment', 67))
%>
</body>
</html>
I get the error:
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot
be displayed.
--------------------------------------------------------------------------
Please try the following:
a.. Click the Refresh button, or try again later.
b.. Open the localhost home page, and then look for links to the
information you want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
If anyone can help me here I'd really be a happier guy. Tag: Crawl a site Tag: 295442
ASP Login Script not working
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C45720.984E6120
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Applies to: Microsoft FrontPage 2000, Microsoft Access 2000, IIS 5.0
Operating System: Microsoft Windows 2000 Professional
I am trying to protect a portion of a web site by allowing users to =
register a username and password & then login with those details, but so =
far I am having only marginal success. I am far from an expert on ASP =
programming, indeed the code I am using comes from "Sams Teach Yourself =
E-Commerce Programming with ASP" but it is ideally suited for my =
purpose.
In short, there are 3 .asp pages (register.asp, login.asp & =
checkpassword.asp - the code for each is below), a global.asa file was =
automatically created and by following the instructions in the book, I =
also created a small Access database called UserDB.mdb, which stores the =
username & password of each user when they register & also verify's =
those details when the user attempts to login again.
The DNS connection has been setup within FrontPage and I have verified =
that this connection works by clicking "Tools", "Web Settings" & the =
"Database" tab, highlighting the DNS connection & clicking Verify.=20
The problems seem to occur when I try to register a new username & =
password, for some strange reason the details I enter are not being =
saved in the database table, and to compound the problem further, if I =
register just a username, or a password but not both, the page simply =
refreshes itself with empty boxes instead of giving an error message to =
indicate that a "username" or "password" must be entered, which if I =
have read the code correctly on the "checkpassword.asp" page, should =
happen.
To further confuse the situation, if I manually enter a username & =
password into the database table and then attempt to click a hyperlink =
taking me to a "test.asp" page, with the INCLUDE FILE: <!-- #INCLUDE =
FILE=3D"checkpassword.asp" -->, I am automatically taken to the =
login.asp, where if I enter the username & password that I manually put =
into the database table, it takes me to the selected "Protected" web =
page. In my mind that clearly shows the DNS connection is working but =
yet it won't store new registered details into the database table, which =
is extremely confusing.
If anyone can see what I may be doing wrong, or point me in the right =
direction, your help & advice will be greatly appreciated. As I pointed =
out earlier I am far from an expert, so any help you can give would be =
ideally suited towards a newbie mentality.
Below is the code for the three .asp pages:
Many thanks in advance
Wayne Smith
register.asp
<%
nextPage =3D Request( "nextPage" )
newUsername =3D Request( "newUsername" )
newPassword =3D Request( "newPassword" )
%>
<HTML>
<HEAD><TITLE>Register"</TITLE></HEAD>
<BODY>
Register at this Web site by selecting a username and password:
<FORM METHOD=3D"post" ACTION=3D"<%=3DnextPage%>">
<INPUT NAME=3D"newUser" TYPE=3D"hidden" VALUE=3D"1">
<P><B>USERNAME:</B>
<INPUT NAME=3D"newUsername" SIZE=3D20 MAXLENGTH=3D"20"=20
VALUE=3D"<%=3DServer.HTMLEncode( newUsername )%>">
<P><B>PASSWORD:</B>
<INPUT NAME=3D"newPassword" SIZE=3D20 MAXLENGTH=3D"20"=20
VALUE=3D"<%=3DServer.HTMLEncode( newPassword )%>">
<P><INPUT TYPE=3D"submit" VALUE=3D"Register!">
</FORM>
</BODY>
</HTML>
-------------------------------------------------------------------------=
---------
login.asp
<HTML>
<HEAD><TITLE>Login</TITLE></HEAD>
<BODY>
<%=3DloginMessage%>
<FORM METHOD=3D"post" ACTION=3D"<%=3DnextPage%>">
<P><B>USERNAME:</B>
<INPUT NAME=3D"username" SIZE=3D20 MAXLENGTH=3D"20"=20
VALUE=3D"<%=3DServer.HTMLEncode( username )%>">
<P><B>PASSWORD:</B>
<INPUT NAME=3D"password" SIZE=3D20 MAXLENGTH=3D"20"=20
VALUE=3D"<%=3DServer.HTMLEncode( password )%>">
<p><INPUT NAME=3D"addCookie" TYPE=3D"Checkbox" VALUE=3D"1"> Remember me =
with a cookie
<P><INPUT TYPE=3D"submit" VALUE=3D"Login">
</FORM>
<p>
<a href=3D"register.asp?nextpage=3D<%Server.URLEncode( nextpage )%>">
Click here to register</a>
</BODY>
</HTML>
-------------------------------------------------------------
checkpassword.asp
<%
CONST useSession =3D TRUE
' Retrieve Form Variables
username =3D TRIM( Request( "username" ) )
password =3D TRIM( Request( "password" ) )
newUser =3D TRIM( Request( "newUser" ) )
newUsername =3D TRIM( Request( "newUsername" ) )
newPassword =3D TRIM( Request( "newPassword" ) )
addCookie =3D TRIM( Request( "addCookie" ) )
' Retrieve Current Page
nextPage =3D Request.ServerVariables( "SCRIPT_NAME" )
' Ready Database Connection
Set Con =3D Server.CreateObject( "ADODB.Connection" )
Con.Open "userDNS"
' Add New User
IF newUser <> "" THEN
IF newUsername =3D "" THEN
showError "You must enter a username"
END IF
IF newPassword =3D "" THEN
showError "You must enter a password"
END IF
IF usernameTaken( newUsername ) THEN
showError "The username you entered has already " &_
"been chosen by a previous user. Please select " &_
"a new username"
END IF
sqlString =3D "INSERT INTO userlist ( user_username, user_password ) " =
&_
"VALUES ('" & newUsername & "','" & newPassword & "')"
Con.Execute sqlString
username =3D newUsername
password =3D newPassword
IF useSession THEN Session( "loggedIn" ) =3D "Yes"
END IF
' Authenticate User
IF Session( "loggedIn" ) =3D "" THEN=20
IF username =3D "" OR password =3D "" THEN
loginMessage =3D "You must login before you can view this page."
showLogin
END IF
result =3D validateLogin( username, password )
IF result =3D 1 THEN
loginMessage =3D "You entered an unregistered username."
showLogin
END IF
IF result =3D 2 THEN
loginMessage =3D "You did not enter a valid password."
showLogin
END IF
IF useSession THEN Session( "loggedIn" ) =3D "Yes"
END IF
' Add a Cookie
IF addCookie <> "" THEN
Response.Cookies( "username" ) =3D username
Response.Cookies( "username" ).Expires =3D "12/25/2037"
Response.Cookies( "password" ) =3D password
Response.Cookies( "password" ).Expires =3D "12/25/2037"
END IF
' Create Security Query String Variable
sq =3D "username=3D" & Server.HTMLEncode( username ) & "&"
sq =3D sq & "password=3D" & Server.HTMLEncode( password )=20
' Create Security Form Variable
sf =3D "<input name=3D""username"" type=3D""hidden"" "
sf =3D sf & "value=3D""" & Server.HTMLEncode( username ) & """>"
sf =3D sf & "<input name=3D""password"" type=3D""hidden"" "
sf =3D sf & "value=3D""" & Server.HTMLEncode( password ) & """>"
' Check Username and Password
FUNCTION validateLogin( theUsername, thePassword )
sqlString =3D "SELECT user_password FROM userlist " &_
"WHERE user_username=3D'" & fixQuotes( username ) & "'"=20
Set RS =3D Con.Execute( sqlString )
IF RS.EOF THEN
validateLogin =3D 1
ELSE
IF RS( "user_password" ) <> thePassword THEN
validateLogin =3D 2
ELSE
validateLogin =3D 0
END IF
END IF
END FUNCTION
' Check Whether Username Already Taken
FUNCTION usernameTaken( theUsername )
sqlString =3D "SELECT user_id FROM userlist " &_
"WHERE user_username=3D'" & fixQuotes( theUsername ) & "'"
Set RS =3D Con.Execute( sqlString )
IF RS.EOF THEN
usernameTaken =3D FALSE
ELSE
usernameTaken =3D TRUE
END IF
RS.Close
Set RS =3D Nothing
END FUNCTION
' Show Error Page
SUB showError( theError )
%>
<HTML>
<HEAD><TITLE>Problem</TITLE></HEAD>
<BODY>
<b>There was a problem with your registration information</b>
<br><%=3DtheError %>
<FORM METHOD=3D"POST" ACTION=3D"register.asp">
<INPUT NAME=3D"nextpage" TYPE=3D"hidden"
VALUE=3D"<%=3Dnextpage%>">
<INPUT NAME=3D"newUsername" TYPE=3D"hidden"
VALUE=3D"<%=3DServer.HTMLEncode( newUsername )%>">
<INPUT NAME=3D"newPassword" TYPE=3D"hidden"
VALUE=3D"<%=3DServer.HTMLEncode( newPassword )%>">
<INPUT TYPE=3D"SUBMIT" VALUE=3D"Continue">
</FORM>
</BODY>
</HTML>
<%
Response.End
END SUB
' Show the Login Page
SUB showLogin
%>
<!-- #INCLUDE FILE=3D"login.asp" -->
<%
Response.End
END SUB
FUNCTION fixQuotes( theString )
fixQuotes =3D REPLACE( theString, "'", "''" )
END FUNCTION
%>
------=_NextPart_000_000C_01C45720.984E6120
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D1>
<DIV><FONT size=3D2>Applies to: Microsoft FrontPage 2000, Microsoft =
Access 2000,=20
IIS 5.0</FONT></DIV>
<DIV><FONT size=3D2>Operating System: Microsoft Windows 2000=20
Professional</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>I am trying to protect a portion of a web site by =
allowing=20
users to register a username and password & then login with those =
details,=20
but so far I am having only marginal success. I am far from an expert on =
ASP=20
programming, indeed the code I am using comes from "Sams Teach Yourself=20
E-Commerce Programming with ASP" but it is ideally suited for my=20
purpose.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>In short, there are 3 .asp pages (register.asp, =
login.asp=20
& checkpassword.asp - the code for each is below), a global.asa file =
was=20
automatically created and by following the instructions in the book, I =
also=20
created a small Access database called UserDB.mdb, which stores the =
username=20
& password of each user when they register & also verify's those =
details=20
when the user attempts to login again.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>The DNS connection has been setup within FrontPage =
and I have=20
verified that this connection works by clicking "Tools", "Web Settings" =
&=20
the "Database" tab, highlighting the DNS connection & clicking =
Verify.=20
</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>The problems seem to occur when I try to register a =
new=20
username & password, for some strange reason the details I enter are =
not=20
being saved in the database table, and to compound the problem further, =
if I=20
register just a username, or a password but not both, the page simply =
refreshes=20
itself with empty boxes instead of giving an error message to indicate =
that a=20
"username" or "password" must be entered, which if I have read the code=20
correctly on the "checkpassword.asp" page, should happen.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>To further confuse the situation, if I manually =
enter a=20
username & password into the database table and then attempt to =
click a=20
hyperlink taking me to a "test.asp" page, with the INCLUDE FILE: <!-- =
#INCLUDE FILE=3D"checkpassword.asp" -->, I am automatically taken to =
the=20
login.asp, where if I enter the username & password that I manually =
put into=20
the database table, it takes me to the selected "Protected" web page. In =
my mind=20
that clearly shows the DNS connection is working but yet it won't store =
new=20
registered details into the database table, which is extremely=20
confusing.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>If anyone can see what I may be doing wrong, or =
point me in=20
the right direction, your help & advice will be greatly appreciated. =
As I=20
pointed out earlier I am far from an expert, so any help you can give =
would be=20
ideally suited towards a newbie mentality.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Below is the code for the three .asp =
pages:</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Many thanks in advance</FONT></DIV>
<DIV><FONT size=3D2>Wayne Smith</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>register.asp</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT color=3D#800000><FONT size=3D2><%</FONT></DIV>
<DIV>
<P><FONT size=3D2>nextPage =3D Request( "nextPage" )</FONT></P>
<P><FONT size=3D2>newUsername =3D Request( "newUsername" )</FONT></P>
<P><FONT size=3D2>newPassword =3D Request( "newPassword" )</FONT></P>
<P><FONT size=3D2>%></FONT></P></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2><HTML></FONT></P>
<P><FONT size=3D2><HEAD><TITLE></FONT></FONT><FONT=20
size=3D2>Register"</FONT><FONT color=3D#0000c0><FONT=20
size=3D2></TITLE></HEAD></FONT></P>
<P><FONT size=3D2><BODY></FONT></P></FONT>
<P><FONT size=3D2>Register at this Web site by selecting a username and=20
password:</FONT></P><FONT color=3D#0000c0>
<P><FONT size=3D2><FORM METHOD=3D</FONT></FONT><FONT =
size=3D2>"post"<FONT=20
color=3D#0000c0> ACTION=3D</FONT>"<FONT=20
color=3D#800000><%=3DnextPage%></FONT>"</FONT><FONT =
color=3D#0000c0><FONT=20
size=3D2>></FONT></P>
<P><FONT size=3D2><INPUT NAME=3D</FONT></FONT><FONT =
size=3D2>"newUser"<FONT=20
color=3D#0000c0> TYPE=3D</FONT>"hidden"<FONT color=3D#0000c0>=20
VALUE=3D</FONT>"1"</FONT><FONT color=3D#0000c0><FONT =
size=3D2>></FONT></P>
<P><FONT size=3D2><P><B></FONT></FONT><FONT=20
size=3D2>USERNAME:</FONT><FONT color=3D#0000c0><FONT =
size=3D2></B></FONT></P>
<P><FONT size=3D2><INPUT NAME=3D</FONT></FONT><FONT =
size=3D2>"newUsername"<FONT=20
color=3D#0000c0> SIZE=3D</FONT>20<FONT color=3D#0000c0>=20
MAXLENGTH=3D</FONT>"20"</FONT><FONT color=3D#0000c0><FONT size=3D2> =
</FONT></P>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2>"<FONT=20
color=3D#800000><%=3DServer.HTMLEncode( newUsername =
)%></FONT>"</FONT><FONT=20
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><P><B></FONT></FONT><FONT=20
size=3D2>PASSWORD:</FONT><FONT color=3D#0000c0><FONT =
size=3D2></B></FONT></P>
<P><FONT size=3D2><INPUT NAME=3D</FONT></FONT><FONT =
size=3D2>"newPassword"<FONT=20
color=3D#0000c0> SIZE=3D</FONT>20<FONT color=3D#0000c0>=20
MAXLENGTH=3D</FONT>"20"</FONT><FONT color=3D#0000c0><FONT size=3D2> =
</FONT></P>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2>"<FONT=20
color=3D#800000><%=3DServer.HTMLEncode( newPassword =
)%></FONT>"</FONT><FONT=20
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><P><INPUT TYPE=3D</FONT></FONT><FONT =
size=3D2>"submit"<FONT=20
color=3D#0000c0> VALUE=3D</FONT>"Register!"</FONT><FONT =
color=3D#0000c0><FONT=20
size=3D2>></FONT></P>
<P><FONT size=3D2></FORM></FONT></P></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2></BODY></FONT></P>
<P><FONT size=3D2></HTML></FONT></P>
<P><FONT=20
size=3D2>----------------------------------------------------------------=
------------------</FONT></P>
<P></FONT><FONT size=3D2>login.asp</FONT></P>
<P><FONT color=3D#0000c0 size=3D1><FONT =
size=3D2><HTML></FONT></P></DIV>
<DIV>
<P><FONT size=3D2><HEAD><TITLE></FONT></FONT><FONT=20
size=3D2>Login</FONT><FONT color=3D#0000c0><FONT=20
size=3D2></TITLE></HEAD></FONT></P>
<P><FONT size=3D2><BODY></FONT></P></FONT><FONT color=3D#800000 =
size=3D2>
<P><%=3DloginMessage%></P></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2><FORM METHOD=3D</FONT></FONT><FONT =
size=3D2>"post"<FONT=20
color=3D#0000c0> ACTION=3D</FONT>"<FONT=20
color=3D#800000><%=3DnextPage%></FONT>"</FONT><FONT =
color=3D#0000c0><FONT=20
size=3D2>></FONT></P>
<P><FONT size=3D2><P><B></FONT></FONT><FONT=20
size=3D2>USERNAME:</FONT><FONT color=3D#0000c0><FONT =
size=3D2></B></FONT></P>
<P><FONT size=3D2><INPUT NAME=3D</FONT></FONT><FONT =
size=3D2>"username"<FONT=20
color=3D#0000c0> SIZE=3D</FONT>20<FONT color=3D#0000c0>=20
MAXLENGTH=3D</FONT>"20"</FONT><FONT color=3D#0000c0><FONT size=3D2> =
</FONT></P>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2>"<FONT=20
color=3D#800000><%=3DServer.HTMLEncode( username =
)%></FONT>"</FONT><FONT=20
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><P><B></FONT></FONT><FONT=20
size=3D2>PASSWORD:</FONT><FONT color=3D#0000c0><FONT =
size=3D2></B></FONT></P>
<P><FONT size=3D2><INPUT NAME=3D</FONT></FONT><FONT =
size=3D2>"password"<FONT=20
color=3D#0000c0> SIZE=3D</FONT>20<FONT color=3D#0000c0>=20
MAXLENGTH=3D</FONT>"20"</FONT><FONT color=3D#0000c0><FONT size=3D2> =
</FONT></P>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2>"<FONT=20
color=3D#800000><%=3DServer.HTMLEncode( password =
)%></FONT>"</FONT><FONT=20
color=3D#0000c0><FONT size=3D2>></FONT></P>
<P><FONT size=3D2><p><INPUT NAME=3D</FONT></FONT><FONT=20
size=3D2>"addCookie"<FONT color=3D#0000c0> TYPE=3D</FONT>"Checkbox"<FONT =
color=3D#0000c0> VALUE=3D</FONT>"1"<FONT color=3D#0000c0>></FONT> =
Remember me with=20
a cookie</FONT></P><FONT color=3D#0000c0>
<P><FONT size=3D2><P><INPUT TYPE=3D</FONT></FONT><FONT =
size=3D2>"submit"<FONT=20
color=3D#0000c0> VALUE=3D</FONT>"Login"</FONT><FONT =
color=3D#0000c0><FONT=20
size=3D2>></FONT></P>
<P><FONT size=3D2></FORM></FONT></P>
<P><FONT size=3D2><p></FONT></P>
<P><FONT size=3D2><a href=3D</FONT></FONT><FONT=20
size=3D2>"register.asp?nextpage=3D<FONT =
color=3D#800000><%Server.URLEncode(=20
nextpage )%></FONT>"<FONT color=3D#0000c0>></P></FONT></FONT>
<P><FONT size=3D2>Click here to register<FONT=20
color=3D#0000c0></a></P></FONT></FONT><FONT color=3D#0000c0>
<P><FONT size=3D2></BODY></FONT></P>
<P><FONT size=3D2></HTML></FONT></P>
<P><FONT=20
size=3D2>-------------------------------------------------------------</F=
ONT></P>
<P><FONT color=3D#000000 size=3D2>checkpassword.asp</FONT></P><FONT =
color=3D#800000>
<P><FONT size=3D2><%</FONT></P>
<P><FONT size=3D2>CONST useSession =3D TRUE</FONT></P>
<P><FONT size=3D2>' Retrieve Form Variables</FONT></P>
<P><FONT size=3D2>username =3D TRIM( Request( "username" ) )</FONT></P>
<P><FONT size=3D2>password =3D TRIM( Request( "password" ) )</FONT></P>
<P><FONT size=3D2>newUser =3D TRIM( Request( "newUser" ) )</FONT></P>
<P><FONT size=3D2>newUsername =3D TRIM( Request( "newUsername" ) =
)</FONT></P>
<P><FONT size=3D2>newPassword =3D TRIM( Request( "newPassword" ) =
)</FONT></P>
<P><FONT size=3D2>addCookie =3D TRIM( Request( "addCookie" ) =
)</FONT></P>
<P><FONT size=3D2>' Retrieve Current Page</FONT></P>
<P><FONT size=3D2>nextPage =3D Request.ServerVariables( "SCRIPT_NAME" =
)</FONT></P>
<P><FONT size=3D2>' Ready Database Connection</FONT></P>
<P><FONT size=3D2>Set Con =3D Server.CreateObject( "ADODB.Connection" =
)</FONT></P>
<P><FONT size=3D2>Con.Open "userDNS"</FONT></P>
<P><FONT size=3D2>' Add New User</FONT></P>
<P><FONT size=3D2>IF newUser <> "" THEN</FONT></P>
<P><FONT size=3D2>IF newUsername =3D "" THEN</FONT></P>
<P><FONT size=3D2>showError "You must enter a username"</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>IF newPassword =3D "" THEN</FONT></P>
<P><FONT size=3D2>showError "You must enter a password"</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>IF usernameTaken( newUsername ) THEN</FONT></P>
<P><FONT size=3D2>showError "The username you entered has already "=20
&_</FONT></P>
<P><FONT size=3D2>"been chosen by a previous user. Please select "=20
&_</FONT></P>
<P><FONT size=3D2>"a new username"</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>sqlString =3D "INSERT INTO userlist ( user_username, =
user_password=20
) " &_</FONT></P>
<P><FONT size=3D2>"VALUES ('" & newUsername & "','" & =
newPassword=20
& "')"</FONT></P>
<P><FONT size=3D2>Con.Execute sqlString</FONT></P>
<P><FONT size=3D2>username =3D newUsername</FONT></P>
<P><FONT size=3D2>password =3D newPassword</FONT></P>
<P><FONT size=3D2>IF useSession THEN Session( "loggedIn" ) =3D =
"Yes"</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>' Authenticate User</FONT></P>
<P><FONT size=3D2>IF Session( "loggedIn" ) =3D "" THEN </FONT></P>
<P><FONT size=3D2>IF username =3D "" OR password =3D "" THEN</FONT></P>
<P><FONT size=3D2>loginMessage =3D "You must login before you can view =
this=20
page."</FONT></P>
<P><FONT size=3D2>showLogin</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>result =3D validateLogin( username, password =
)</FONT></P>
<P><FONT size=3D2>IF result =3D 1 THEN</FONT></P>
<P><FONT size=3D2>loginMessage =3D "You entered an unregistered=20
username."</FONT></P>
<P><FONT size=3D2>showLogin</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>IF result =3D 2 THEN</FONT></P>
<P><FONT size=3D2>loginMessage =3D "You did not enter a valid =
password."</FONT></P>
<P><FONT size=3D2>showLogin</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>IF useSession THEN Session( "loggedIn" ) =3D =
"Yes"</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>' Add a Cookie</FONT></P>
<P><FONT size=3D2>IF addCookie <> "" THEN</FONT></P>
<P><FONT size=3D2>Response.Cookies( "username" ) =3D username</FONT></P>
<P><FONT size=3D2>Response.Cookies( "username" ).Expires =3D =
"12/25/2037"</FONT></P>
<P><FONT size=3D2>Response.Cookies( "password" ) =3D password</FONT></P>
<P><FONT size=3D2>Response.Cookies( "password" ).Expires =3D =
"12/25/2037"</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>' Create Security Query String Variable</FONT></P>
<P><FONT size=3D2>sq =3D "username=3D" & Server.HTMLEncode( username =
) &=20
"&"</FONT></P>
<P><FONT size=3D2>sq =3D sq & "password=3D" & Server.HTMLEncode( =
password )=20
</FONT></P>
<P><FONT size=3D2>' Create Security Form Variable</FONT></P>
<P><FONT size=3D2>sf =3D "<input name=3D""username"" =
type=3D""hidden"" "</FONT></P>
<P><FONT size=3D2>sf =3D sf & "value=3D""" & Server.HTMLEncode( =
username )=20
& """>"</FONT></P>
<P><FONT size=3D2>sf =3D sf & "<input name=3D""password"" =
type=3D""hidden""=20
"</FONT></P>
<P><FONT size=3D2>sf =3D sf & "value=3D""" & Server.HTMLEncode( =
password )=20
& """>"</FONT></P>
<P><FONT size=3D2>' Check Username and Password</FONT></P>
<P><FONT size=3D2>FUNCTION validateLogin( theUsername, thePassword =
)</FONT></P>
<P><FONT size=3D2>sqlString =3D "SELECT user_password FROM userlist "=20
&_</FONT></P>
<P><FONT size=3D2>"WHERE user_username=3D'" & fixQuotes( username ) =
& "'"=20
</FONT></P>
<P><FONT size=3D2>Set RS =3D Con.Execute( sqlString )</FONT></P>
<P><FONT size=3D2>IF RS.EOF THEN</FONT></P>
<P><FONT size=3D2>validateLogin =3D 1</FONT></P>
<P><FONT size=3D2>ELSE</FONT></P>
<P><FONT size=3D2>IF RS( "user_password" ) <> thePassword =
THEN</FONT></P>
<P><FONT size=3D2>validateLogin =3D 2</FONT></P>
<P><FONT size=3D2>ELSE</FONT></P>
<P><FONT size=3D2>validateLogin =3D 0</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>END FUNCTION</FONT></P>
<P><FONT size=3D2></FONT> </P>
<P><FONT size=3D2>' Check Whether Username Already Taken</FONT></P>
<P><FONT size=3D2>FUNCTION usernameTaken( theUsername )</FONT></P>
<P><FONT size=3D2>sqlString =3D "SELECT user_id FROM userlist " =
&_</FONT></P>
<P><FONT size=3D2>"WHERE user_username=3D'" & fixQuotes( theUsername =
) &=20
"'"</FONT></P>
<P><FONT size=3D2>Set RS =3D Con.Execute( sqlString )</FONT></P>
<P><FONT size=3D2>IF RS.EOF THEN</FONT></P>
<P><FONT size=3D2>usernameTaken =3D FALSE</FONT></P>
<P><FONT size=3D2>ELSE</FONT></P>
<P><FONT size=3D2>usernameTaken =3D TRUE</FONT></P>
<P><FONT size=3D2>END IF</FONT></P>
<P><FONT size=3D2>RS.Close</FONT></P>
<P><FONT size=3D2>Set RS =3D Nothing</FONT></P>
<P><FONT size=3D2>END FUNCTION</FONT></P>
<P><FONT size=3D2>' Show Error Page</FONT></P>
<P><FONT size=3D2>SUB showError( theError )</FONT></P>
<P><FONT size=3D2>%></FONT></P></FONT>
<P><FONT color=3D#0000c0><FONT size=3D2><HTML></FONT></P></FONT>
<P><FONT size=3D2><FONT =
color=3D#0000c0><HEAD><TITLE></FONT>Problem<FONT=20
color=3D#0000c0></TITLE></HEAD></P></FONT></FONT>
<P><FONT color=3D#0000c0><FONT size=3D2><BODY></FONT></P></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><b></FONT>There was a =
problem with=20
your registration information<FONT =
color=3D#0000c0></b></P></FONT></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><br></FONT><FONT=20
color=3D#800000><%=3DtheError %></P></FONT></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><FORM =
METHOD=3D</FONT>"POST"<FONT=20
color=3D#0000c0> ACTION=3D</FONT>"register.asp"<FONT=20
color=3D#0000c0>></P></FONT></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><INPUT =
NAME=3D</FONT>"nextpage"<FONT=20
color=3D#0000c0> TYPE=3D</FONT>"hidden"</FONT></P><FONT color=3D#0000c0>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2><FONT=20
color=3D#000000>"</FONT><FONT =
color=3D#800000><%=3Dnextpage%></FONT><FONT=20
color=3D#000000>"</FONT><FONT color=3D#0000c0>></P></FONT></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><INPUT =
NAME=3D</FONT>"newUsername"<FONT=20
color=3D#0000c0> TYPE=3D</FONT>"hidden"</FONT></P><FONT color=3D#0000c0>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2><FONT=20
color=3D#000000>"</FONT><FONT color=3D#800000><%=3DServer.HTMLEncode( =
newUsername=20
)%></FONT><FONT color=3D#000000>"</FONT><FONT=20
color=3D#0000c0>></P></FONT></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><INPUT =
NAME=3D</FONT>"newPassword"<FONT=20
color=3D#0000c0> TYPE=3D</FONT>"hidden"</FONT></P><FONT color=3D#0000c0>
<P><FONT size=3D2>VALUE=3D</FONT></FONT><FONT size=3D2><FONT=20
color=3D#000000>"</FONT><FONT color=3D#800000><%=3DServer.HTMLEncode( =
newPassword=20
)%></FONT><FONT color=3D#000000>"</FONT><FONT=20
color=3D#0000c0>></P></FONT></FONT>
<P><FONT size=3D2><FONT color=3D#0000c0><INPUT =
TYPE=3D</FONT>"SUBMIT"<FONT=20
color=3D#0000c0> VALUE=3D</FONT>"Continue"<FONT =
color=3D#0000c0>></P></FONT></FONT>
<P><FONT color=3D#0000c0><FONT size=3D2></FORM></FONT></P></FONT>
<P><FONT color=3D#0000c0><FONT size=3D2></BODY></FONT></P></FONT>
<P><FONT color=3D#0000c0><FONT size=3D2></HTML></FONT></P></FONT>
<P><FONT color=3D#800000><FONT size=3D2><%</FONT></P>
<P><FONT size=3D2>Response.End</FONT></P>
<P><FONT size=3D2>END SUB</FONT></P>
<P><FONT size=3D2>' Show the Login Page</FONT></P>
<P><FONT size=3D2>SUB showLogin</FONT></P>
<P><FONT size=3D2>%></FONT></P></FONT>
<P><FONT color=3D#808080><FONT size=3D2><!-- #INCLUDE =
FILE=3D"login.asp"=20
--></FONT></P></FONT>
<P><FONT color=3D#800000 size=3D1><FONT size=3D2><%</FONT></P>
<P><FONT size=3D2>Response.End</FONT></P>
<P><FONT size=3D2>END SUB</FONT></P>
<P><FONT size=3D2>FUNCTION fixQuotes( theString )</FONT></P>
<P><FONT size=3D2>fixQuotes =3D REPLACE( theString, "'", "''" =
)</FONT></P>
<P><FONT size=3D2>END FUNCTION</FONT></P>
<P><FONT =
size=3D2>%></FONT></P></FONT></FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_000C_01C45720.984E6120-- Tag: Crawl a site Tag: 295440
Tricky question !!! logging file access
A tricky question:
I have a file i my local web sever IIS which can be accessed through the
internet, how do i develope a log file to know who accessed the file and
when??
is it also possible to write a script that detects when the file is accessed
and send an e mail to a certain recepient (ex me) about the ip addresss and
time when the file was accessed?
Thanks
Ammar Tag: Crawl a site Tag: 295437
aspSmartupload problem
Hi All,
> Hi experts,
>
> I am trying to build a page that allows file uploading from a browser
> My ISP where the page will be located, only supports Smartupload
> I am testing on a small hubbed local network, with PWS
> Any help is appreciated.
> ---------------------
> 'rqstupl.asp contents
>
>
> ><HTML>
> ><BODY BGCOLOR="white">
> ><FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="txtupl.asp">
> ><INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><br>
> ><INPUT TYPE="SUBMIT" VALUE="Upload">
> ></FORM>
> ></BODY>
> ></HTML>
> -------------
> input in form = usblog.txt
> -------------
> 'txtupl.asp contents
> <%
> response.write "txtupl<br>"
> Dim myUpload 'declare the component
> Dim intCount ' count the number of uploaded files
> Dim File 'declare the file to upload
> dim item, fic, i
> intCount=0 'initialize the counter
>
> ' error management
> 'On Error Resume Next
>
> 'component creation
> Set myUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
>
> 'limit the file size to 50 Kb
> myUpload.MaxFileSize = 50000
>
> ' limit the file extensions to pictures files
> myUpload.allowedFilesList="txt"
>
> 'Select files on the user computer
> myUpload.Upload
>
> Response.Write("Number of files =" & myUpload.Files.count&"<BR>")
>
> ' checking all the files
> For each file In myUpload.Files
> Response.Write("Name =" & File.FileName&"<BR>")
> Response.Write("Size =" & File.Size&"<BR>")
> ' presence test
> If not File.IsMissing then
> ' ---------------here sits the trouble
> '
> response.write (Server.MapPath("database/msgs/") & "\" & file.FileName)
> file.SaveAs (Server.MapPath("database/msgs/") & "\" & file.FileName)
> ' -----------------------------
> '
> If Err.Number=0 then
> direction="saved"
> Else
> direction="error: " & Err.description
> End if
>
> end if
> Next
>
> Set myUpload=nothing
>
> ' error management
>
> ' redirect to the result display
> Response.write direction
> %>
> ------------------
> 'response output screen
>
> txtupl
> Number of files =1
> Name =usblog.txt
> Size =89
> D:\Inetpub\wwwroot\database\msgs\usblog.txt
> saved
>
> -----------
> I have been trying to modify the "save" line to any construction to no avail.
> I can access all the properties of "file."
> I have no error responses or script aborts.
> Asp handling works, vbscript and jscript works
> The destination folder is writable
> I have another asp testing page that creates and modifies a file in that folder.
>
> --------- The one thing that doesn't work: there is no file created! --------------
>
> I am using Win98SE, PWS installed, testing application input from a second PC, locally hubbed.
> What am I missing?
>
> Thanks in advance
I have uploaded these asp files to the ISP server
and there it works perfect..
So it has to be some configuration quirk on local PWS
The regsvr32 d:\inetpub\aspSmartUpload.dll has passed without errors
The aspSmartUploadUtil.dll sits in c:\windows, %path% settings include c:\windows;
I have searched aspSmartupload site for more info, I cant see anything relevant
Why doesn't this upload thing work ???
Any help strongly appreciated
--
Replies in the same thread please
Windows 98 links to solutions
http://jake98.no-ip.info
Best Regards
Jake Tag: Crawl a site Tag: 295435
Can if statements be used in global.asa?
When using "if then" statements in global, I get the following error:
a.. Error Type:
(0x8002802B)
Element not found.
//global.asa, line 12
Can I use if then statements in global?
Here is the statement:
if request.ServerVariables("HTTP_HOST") = "localhost" then
Application("question") = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID='********';'Password='***********';Initial
Catalog='******';Data Source=localhost"
else
Application("question") = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID='**********';Password='**********';Initial
Catalog='*****';Data Source=<remote-host>"
end if
--
Kind Regards
Rudi Ahlers
+27 (82) 926 1689
Greater love has no one than this, that he lay down his life for his friends
(John 15:13). Tag: Crawl a site Tag: 295430
ASPX and form loading.
Dear Anyone,
If this is not the appropriate place to as an ASPX question, please
point to the correct location.
If it is the right place then, how can I open a second web form after
the user clicks a button on the first form. The project is in C# and ASPX.
James Lattanzio Tag: Crawl a site Tag: 295427
Is it possible to crawl a site using ASP & XML HTTP?
I know you can hit one link, but how can you go through each link in a
page and validate that it returns 200?
Dave wrote:
> Is it possible to crawl a site using ASP & XML HTTP?
>
> I know you can hit one link, but how can you go through each link in a
> page and validate that it returns 200?