automating a daily function
using classic asp and COMless scripting, is there a way for the asp on a
server to automatically perform a function on a scheduled time, im thinking
of things like database replication, clearing old data etc.
Mark Tag: stop session Tag: 313009
fill combo box with data from database
This is a table created in ms sql:
create table categories
(
CategoryID int IDENTITY,
CategoryDescription varchar(30),
ParentCategoryID int
);
This is a stored procedure created in ms sql:
create procedure usp_retrieveCategories
AS SET NOCOUNT ON
SELECT CategoryID, CategoryDescription FROM categories WHERE
CategoryID >= 1
Return
GO
This is a code to fill my combo box on my .asp page:
<select name="select" class="TextField1">
<%
openDB()
objConn.usp_retrieveCategories, rs
while not rs.eof
%>
<option
value=<%=rs("CategoryID")%>><%=rs("CategoryDescription")%>
<%
wend
CloseDB()
%>
</select>
I am getting an error:
Error Type:
ADODB.Connection (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
The error points to objConn.usp_retrieveCategories, rs
How do I solve the problem?
Your help is kindly appreciated.
Regards
Eugene Anthony
*** Sent via Developersdex http://www.developersdex.com *** Tag: stop session Tag: 312998
Regional settings in IIS6
Dear All,
I am trying to set a webserver to use French regional settings for testing
ASP pages.
According to http://support.microsoft.com/kb/q306044, for IIS5, this is a
matter of changing the regional settings for the authenticated user, and if
this user does not have a user profile then the default regional settings.
Unfortunately, this does not seem to be working in IIS6, in that I have
change the default user's settings and I am still getting English dates. Can
anyone tell me if this is because the way IIS chooses its settings has
changed for IIS6 or just because I have done something wrong?
Thanks,
Jonathan Tag: stop session Tag: 312990
errorhandling inc-files
I have a rather big project written in ASP 3.0. It has more dan 200
pages and i have 4 inc-files with general functions that are used in
almost al the pages.
When an error occures, i get a mail with the description, file were the
error did occur but the problem is that when the error occures in the
inc file i get the name of the inc file as page. This is rather
difficult because i want to know where the error occured in the ASP
page. Is this possible or how can i get the name of that ASP page. Some
sort of a stack trace. It would be great if i also can get the number
where the function is called in the inc file but i don't think that
would be possible. Tag: stop session Tag: 312986
week number of month
Hello,
I need know the week nuber of the month.
I know the function datepart() but returns the week number of the year a
number between (1,53)
I need a number between (1,4 o5).
There is a function or method that i can use to do it?
Thanks a lot. Tag: stop session Tag: 312985
Converting number to percentage Function
Hi Im Leo
I want to convert a number to percentage, is there any built-in function for
this?
Thanks Tag: stop session Tag: 312983
Converting Number to Percentage Function
Hi Im Leo
I want to convert a number to percentage, is there any built-in function for
this?
Thanks Tag: stop session Tag: 312982
using ASP to zip up file for downloading?
I am running a windows 2000 sv with IIS. My asp script creates a text file
with an activation generated and put into the text file, so that the text
file can be inported into a software program tha I created. This take away
the maunuly typing in the code.
Is thier an easy way to use asp to zip of the file and then the user can
download the file?
My other question is, is there a way to create a function in asp that can
run when IE closes. I want to delete the file that was created for the user
when the user exits the page, so that they don't fill my hard drive.
Thanks Tag: stop session Tag: 312978
Transactions in an ASP Page
We are running a website on 3 W2K servers running IIS 5.0 as the webservers
and using a server running under Windows Server 2003 for the database
servers. All of our ASP pages are written using VBScript and we use COM
objects written in VB for our business logic.
One of our pages was written using a transaction. The page started with
@Transaction = Required. Basically a form posts to the page, the page
retrieves info from the form, it then uses one COM object to update a couple
SQL Server tables in one of our database, then it uses another COM object to
write a record to a text file in a Share on the database server, it then uses
a 3rd COM object to update some tables in a second database. Once it
completes these steps, it executes ObjectContext.CommitTransaction then
redirects the user to a different page.
This page has been working well for us for a few years. Then about 3 1/2
weeks ago, we changed our the database server to Windows Server 2003, it was
previously another W2K box. Since then this page hangs. I threw in some
debug statements that write to a text file on one of the webservers and I
found that every single one of the statements prior to
ObjectContext.CommitTransaction is executing but I never get past it. It
appears that since the transaction is never committed that the objects
created by the page are remaining and never getting cleaned up. Eventually
this hangs the whole server.
Since the problem started happening after we upgraded the database server to
Windows 2003, I'm wondering if anyone has ever heard of issues using ASP
Transactions when writing to text files on Windows 2003 servers from a W2K
server?
I removed the transaction from the page and it seems to work fine. I'm just
wondering if maybe there is another way so we can keep the transaction.
Thanks,
Evan Nelson
Here's a shortened version of the ASP page. When I commented out the lines
that I've put *** in front of the page seems to work.
***<% @Transaction = Required %>
<% Option Explicit
On Error Resume Next
** All the DIM statements are omitted
'Retrieve the registration information
lngConsultantID = Request.QueryString("ConsultantID")
lngChildren = Request.Form("children")
** Several Request.Form statements are omitted
'Save the registration information in the consultant tables
Set objConsultant = Server.CreateObject("Consult.Consultant")
objConsultant.Initialize(lngConsultantID)
strUserName = objConsultant.GetNewUserID
** Several lines that set properties on the object are omitted
objConsultant.UpdateStatus = 0
objConsultant.Update
** The next line actually makes an email account on a third party server - I
have verified that it has been created.
strErrorID = objConsultant.CreateMyEmail(strMyEmailAddress)
objConsultant.Release
Set objConsultant = Nothing
err.Clear
'Write out the registration information in the registration transfer file
** This is the COM object that is writing to the text file on the Database
server disk
share - I am seeing the record in the text file
** NOTE: If I commented out these lines the problem also went away.
Set objDataStore = Server.CreateObject("DataStore.DataWrite")
objDataStore.FileWrite CLng(lngConsultantID)
** The previous method call has more arguments that I have omitted
Set objDataStore = Nothing
err.Clear
' Build a WST Profile now that consultant has registered.
Set objWConsultant = Server.CreateObject("PHWebSalesTools.clsConsultant")
blnIsValid = True
blnIsValid = objWConsultant.ReBuildWSTProfile( CLng(lngConsultantID),
vntConsultantData )
vntConsultantData = ""
blnIsValid = objWConsultant.isValidConsultant(strUserName,
Request.Form("password"), "", vntConsultantData)
Set objWConsultant = Nothing
err.Clear
If blnIsValid Then
strFullName = ( Trim(vntConsultantData(FIRST_NAME,0)) & " " &
Trim(vntConsultantData(LAST_NAME,0)) )
**Several lines that retrieve info from the vntConsultant are removed
' Create a Session and load default information
Set objSession = Server.CreateObject("PHWebSalesTools.clsSession")
strErrorID = objSession.CreateSession(lngConsultantID, strLanguageID,
vntSessionID)
strErrorID = objSession.preLoadConsultantData(vntSessionID, lngConsultantID)
** Several lines that set more properties of objSession have been
omitted Set objSession = Nothing
err.Clear
End If
ObjectContext.SetComplete
strResponse = ("registerok.asp?sessionid=" & vntSessionID)
Response.Redirect strResponse
%> Tag: stop session Tag: 312974
CDOSYS problems
This is a problem that we saw before on our asp site, but don't know how to
fix it. We are seeing it on our .net site also.
We have our email sending from our Windows 2003 server with exchange fine,
unless we send to an alias.
It never gets there.
I can send directly and it works fine and the CDOSYS works fine to a
non-alias account.
I have the following code:
Dim Message As New MailMessage()
' message.From = webMasterEmail
message.From = "Registration@oursystem.com"
message.To = email.text
message.Subject = "Confirmation Required"
message.Body = "This is a test message"
message.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = mailServer
smtpMail.Send(message)
This works fine when the message.To is to my yahoo, dslextreme as well as my
normal business account. If I send to my alias account at work it never
shows up. We seem to have this with all our aliases. But I can send
directly to the alias from outlook without any problem.
I don't think this is an exchange problem, as it works fine if I send to my
alias from my email client.
Anyone know why this doesn't work?
Thanks,
Tom Tag: stop session Tag: 312961
Export to Excel
I have an ASP page that calls ASP routines that I created that execute
a database query and return the results to a recordset. I then iterate
through the recordset and display the data in a table. Before I iterate
through the recordset I instruct the browser that the content type is
Excel using the following line:
(Response.ContentType = "application/vnd.ms-excel")
This works fine with Excel 2003 but with older versions (I tested Excel
97) the HTML included within the include files (on Page One) is
displayed in an Excel worksheet.
Page One - Begins with Include files (which contain my subroutines and
databse connection information). Then I have a Select statement to
determine which export users want. When I hit the case I need I then
call a Sub routine that exports the data to Excel.
Page Two - this page contains all of my custom functions and
procedures.
Page One Example Code:
<!-- #INCLUDE FILE="../../../includes/common_settings.asp" -->
<!-- #INCLUDE FILE="../includes/composite_settings.asp" -->
<!-- #INCLUDE FILE="../includes/composite_functions.asp" -->
<%
sSymbol = Request("Symbol")
sExportType = Request("ExportType")
'Determine Selected Export Type
Select Case lcase(sExportType)
' '
'QUARTERLY EXPORT
Case "quarter"
' '
'Execute the Display Quarter Procedure
call DisplayQuarterExport(sSymbol)
' '
'ANNUAL EXPORT
Case "annual"
' '
'Execute the Display Annual Procedure
call DisplayAnnualExport(sSymbol)
' '
'RAW EXPORT
Case "raw"
' '
'Execute the Display Annual Procedure
call DisplayRawExport(sSymbol)
' '
End Select
%>
Page Two Procedure:
<%
Sub DisplayQuarterExport(pSymbol)
'Execute Quarter Function
set pRSQuarter = QuarterExportQuery(pSymbol)
' '
'Tell the Browser to redirect the output to Excel
Response.ContentType = "application/vnd.ms-excel"
' '
'Check is Recordset contains data
If pRSQuarter.RecordCount > 0 then
' '
'Move to the first record in the recordset
pRSQuarter.MoveFirst
' '
'Display the title bar
Response.Write "<table border=1>"
Response.Write "<tr>"
' '
'Iterate through the fields collection
for each field in pRSQuarter.Fields
Response.Write "<td>"
Response.Write "<b>" & replace(field.name,"_"," ") & "</b>"
Response.Write "</td>"
next
' '
Response.Write "</tr>"
' '
'Move to the first record in the recordset
pRSQuarter.MoveFirst
' '
'Display data
Do until pRSQuarter.EOF
Response.Write "<tr>"
' '
'Composite Code
Response.Write "<td>"
Response.Write trim(pRSQuarter.Fields("Composite").Value)
Response.Write "</td>"
'Composite Date
Response.Write "<td>"
Response.Write pRSQuarter.Fields("Composite_Date").Value
Response.Write "</td>"
'Gross Return
Response.Write "<td>"
Response.Write Round(pRSQuarter.Fields("Gross").Value,2) & "%"
Response.Write "</td>"
'Gross UV
Response.Write "<td>"
Response.Write Round(pRSQuarter.Fields("Gross_UV").Value,2)
Response.Write "</td>"
'Net Return
Response.Write "<td>"
Response.Write Round(pRSQuarter.Fields("Net").Value,2) & "%"
Response.Write "</td>"
'Net UV
Response.Write "<td>"
Response.Write Round(pRSQuarter.Fields("Net_UV").Value,2)
Response.Write "</td>"
'Total Equity
Response.Write "<td>"
Response.Write pRSQuarter.Fields("Total_Equity").Value
Response.Write "</td>"
'Total Fixed
Response.Write "<td>"
Response.Write pRSQuarter.Fields("Total_Fixed").Value
Response.Write "</td>"
'Cash
Response.Write "<td>"
Response.Write pRSQuarter.Fields("Cash").Value
Response.Write "</td>"
' '
Response.Write "</tr>"
pRSQuarter.MoveNext
Loop
' '
'Close Quarter Export Recordset
CloseRS(pRSQuarter)
' '
'Close Database Connection
CloseDBConnection()
' '
Response.Write "</table>"
' '
'Display Error Message is no results were found
Else
Response.Write "Your Query returned (0) results."
' '
End If
' '
End Sub
%>
Again this works great if I have Excel 2003 but for older versions of
Excel it displays the HTML that is contained within the include files
on page one.
Here is my assumption but I have no clue why Excel 2003 works. I am
assuming that the include file content is written to the screen (behind
the scenes) and when I instruct the browser that the content is Excel,
the include file data is included in the "content" and is displayed in
Excel.
Please help, I am racking my head against the wall with this one. Tag: stop session Tag: 312959
Classic ASP Classes
I've been working in .NET for some time now and I don't remember specifically
how asp classes are cleaned up in classic asp. I've been put on a Classic
ASP project(ugh) and we're having some serious stability problems. Once we
reach a point of sustained CPU useage of over 80% IIS 6 restarts the w3wp.exe
process which of course terminates all sessions and resets the website. I've
noticed that the previous developer has an include which creates a couple of
class objects in ASP. Not third party or "CreateObject" objects, but ASP
classes. This include is in A LOT of files and the classes not being
destroyed in any of them.
My question is could this be the problem? I seem to remember a problem with
ASP classes and not destroying them causing leaks of some sort. I need to
mention that the memory doesn't seem to be leaking but the CPU utilization
goes wacko as if ASP/IIS is corrupt. My environment is Windows 2k3 and IIS
6. The previous environment was Windows 2K and IIS5. Both environments had
the problem.
Before I go through these hundreds of files I was wondering if anyone
remember what the problem was with ASP classes not being destroyed.
Thanks for any help. Tag: stop session Tag: 312951
repeater problem
Hello,
I want to set a unique id for each item in a repeater like this:
<asp:repeater id=__theTabStrip runat="server" DataSource='<%#
DataBinder.Eval(Container,"TabText") %>'>
<ItemTemplate>
<asp:Button Runat="server" id="<%# Container.DataItem %>" BackColor="<%#
SetTabBackColor(Container) %>" />
</ItemTemplate>
</asp:repeater>
However, the id="<%# Container.DataItem %>" generates an error:'<%#
Container.DataItem %>' is not a valid identifier.
Would someone please tell me what I did wrong?
--
help, help Tag: stop session Tag: 312938
Double apostrophes
I'm sure this has to be a simple fix. I just cannot figure it out.
To resolve the typical apostrope issue, I have the
acarriername = Replace(txtcarriername.text, "'", "''")
My problem is that 2 apostrophes are now inserted, instead of one. For
example if someone types in IT'S NICE, when it is displayed in the input
text box later (to allow a user to change it), it says IT''S NICE.
This is a sql 2000 database.
Thanks for the help.
*** Sent via Developersdex http://www.developersdex.com *** Tag: stop session Tag: 312937
validating a non float integer value
The code bellow:
function isInt(input)
isInt = true
for i=1 to len(input)
d = Mid(input,i,1)
if Asc(d) < 48 OR Asc(d) > 57 then
isInt = false
exit for
end if
next
end function
I tried replacing with:
function isInt(input)
Set re = new RegExp
re.Pattern = "[0-9]"
isInt = re.test(input)
end function
But dont seem to work.
How do I solve the problem?.
Your help is kindly appreciated.
Regards
Eugene Anthony
*** Sent via Developersdex http://www.developersdex.com *** Tag: stop session Tag: 312933
trying to send 8 bit chars under IIS6
Greets,
Part of the content of one of our web pages uses wingdings and Chr(239)
through Chr(242) (which are little arrow outlines, though that's not really
important.)
It worked just fine in Windows 2000 Server, but now under Server 2003 it
seems that characters above 127 get converted somehow, and our code no
longer produces the desired effect.
Does anyone know how to make it send our content without modification, or
how to encode it in a way that it makes it out to the browser with the
intended character value (as opposed to some thoroughly useless conversion
to a 7 bit value)?
tia,
Mark Tag: stop session Tag: 312921
Strip Time from Datetime
I have a field with datetime values like below LISTING 1. Can someone help
me write code strip the time part so only values like "7/15/2005" will be
left.
Note - We must be able to strip dates with double digit months and days, so
i can't just use the right function with a hard coded parameter.
LISTING 1
mydatetimevalue = "7/15/2005 8:00:00 AM" Tag: stop session Tag: 312915
how to use the select name to show in the internal workgroup/domai
Hello everyone,
I had a program on my web server, that is http://computer1/Test/test1.aspx,
actually computer1 is the web server name, because this is a internal program
inside the domain/workgroup, I would like to know, in order to be easy to
access this link, I would like to just type in http://internalweb1 so that is
link can actually display the page for http://computer1/Test/test1.aspx , is
that a good way to do this issue? Is that any setting in the code we can do
that? By the way, the code for test1.aspx is C#..
Thanks.
Yezanxiong Tag: stop session Tag: 312913
post errors oh my!
I am creating an asp page to collect username/password from the user
and validate it against the DB.
Problem is, it's like this:
- Page initially shows user and pwd inputs with a submit button
- Page submits to itself using POST method
- Now armed with user and password, using ADO I verify information
against database and if it's correct, the main page shows.
Two problems:
1) is the password information secure when I use 'post'? can someone
somehow steal this with sniffers or something?
2) If there is a problem in the page, like connection or otherwise,
the browser shows a 'The page cannot be displayed' and down the page it
shows 'POST Data: ' which includes username and password! this can't be
good can it?
What can I do to improve security here? Tag: stop session Tag: 312901
zip and tel function
Bellow are two functions that I use to validate my zipcode and telephone
number:
function isInt(input)
on error resume next
Dim Temp
Temp = Clng(input)
isInt = (err=0 and inStr(input,".") = 0)
on error goto 0
end function
function isPhone(input)
Set re = new RegExp
re.Pattern = "[\s\-\(\)\+]"
re.Global = true
isPhone = (isInt(re.replace(input,"")))
end function
function isZip(input)
Set re = new RegExp
re.Pattern = "[\s\-]"
re.Global = true
isZip = (isInt(re.replace(input,"")))
end function
Are these functions considered to be feasible for validation?.
Your help is kindly appreciated.
Regards
Eugene Anthony
*** Sent via Developersdex http://www.developersdex.com *** Tag: stop session Tag: 312898
COM object in a service usable from ASP but not ASP.Net
Weird goings on over here, I have a COM object DCServerAdmin, that I
can break in when I attach the debugger to the service that creates the
object and I call a method on that object from an ASP page.
Now, if the method on the DCServerAdmin COM object is called from an
ASP.Net (C# DLL) page, it never breaks in the service's process BUT the
ASP.Net code doesn't report any exceptions. I don't have immediate
access to the C# code so I can do any tests on it just yet, but it
looks totally normal. I know there are process differences between ASP
and ASP.Net (ASP shares its process with other ASP pages, ASP.Net code
runs in its own, et cetera...)
TIA,
WTH Tag: stop session Tag: 312897
type mismatch and session variables
I am having a problem with a page that creates a treeview from a database,
by reloading itself on each request for a new folder to be explored.
The problem revolves around using an array to store the data, that is
copied to a session variable, and reloaded from that with each new view.
That is, on first opening the page, the array is created and populated,
then copied over; subsequent reloads of the page load the session variable,
rather than create the array. This is where the problem lies - by DIMing
the array, the first load of the page is fine, but a type mismatch pops up
when the session is pulled in to the array name; not DIMing the array, the
first load fails due to not declaring the array.
Currently the ony way I have round the problem is to switch option explicit
off and not DIM any variable. If there was a way to have the session
variable and array co-exist to start with, that would be good.
TIA Tag: stop session Tag: 312889
How to download large (400MB +) files from an asp.net page???
Hi,
I am trying to find a working solution for download of large files (400-800
MB)...
But this seems almost impossible to find a working example.
I have tried Response.Transmitfile, this works for some peopleâ?¦but in my
case the server reset the connection after approx. 20 minutes and sometimes
after
7-8 minutesâ?¦the download speed is however very good 400MB takes about 10
minutes to download.
I have also tried the code below, this solution also resets the connection
after 4-5 MBâ?¦and the download goes very slow approx. 55 kb/sâ?¦
Please does anyone have any ideas or proposals?
Is it possible to download via FTP?
Is it possible to use resume of broken downloads somehow?
Are there any components on the market that can achieve this?
'Download the selected file
Response.Buffer = False
Server.ScriptTimeout = 100
Dim FullPath As String = Server.MapPath(currentPath + StrFileName)
Dim DownloadFileInfo As New FileInfo(FullPath)
Dim Name = DownloadFileInfo.Name
Dim Ext = DownloadFileInfo.Extension
Dim stream = New System.IO.FileStream(FullPath, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.Read)
Dim StrFileType As String = ""
If Not IsDBNull(Ext) Then
Ext = LCase(Ext)
End If
Select Case Ext
Case ".exe"
'Exe file
StrFileType = "application/octet-stream"
Case ".zip"
'Zip file
StrFileType = "application/x-zip-compressed"
Case ".pdf"
'Pdf file
StrFileType = "application/pdf"
Case ".doc"
'MS Word
StrFileType = "Application/msword"
Case ".dll"
'Dll file
StrFileType = "application/x-msdownload"
Case ".html", ".htm"
'Html file
StrFileType = "text/HTML"
Case ".txt"
'Txt file
StrFileType = "text/plain"
Case ".jpeg", ".jpg"
'Jpg picture
StrFileType = "image/JPEG"
Case Else
StrFileType = "application/octet-stream"
End Select
'Clear the headers
Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
'Add the download headers
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" + Name)
If StrFileType <> "" Then
Response.ContentType = StrFileType
End If
Response.AddHeader("Content-Length", DownloadFileInfo.Length)
Dim buffer(10000) As Byte
Dim length As Long
'Total bytes to read:
Dim bytesToRead As Long = stream.Length
Dim UserHasDownload As Boolean = False
Try
'Read the bytes from the stream in small portions.
While (bytesToRead > 0)
'Make sure the client is still connected.
If (Response.IsClientConnected) Then
'Read the data into the buffer and write into the output stream.
length = Int(stream.Read(buffer, 0, 10000))
Response.OutputStream.Write(buffer, 0, length)
Response.Flush()
'We have already read some bytes.. need to read only the remaining.
bytesToRead = bytesToRead - length
UserHasDownload = True
Else
'Get out of the loop, if user is not connected anymore..
bytesToRead = -1
UserHasDownload = False
End If
End While
Catch
'An error occurred..
Finally
End Try
stream.Close() Tag: stop session Tag: 312877
ASP.NET 2 apps and Win XP 64
I have a dual boot machine, runs Win XP pro and Win XP Pro 64, XP boots from
C and XP 64 boots from D.
They both have VS 2005 Beta 2 installed.
I have a webapp developed in Win XP (32) which has gone well and runs fine
in XP.
I Now want to get this same app running under IIS on XP 64.
I have had some issues as it is unclear exactly how to do this, but I played
around with Publish option in VS 2005 IDE and got the app copied or whatever,
to the Default Web Site, the app is invisible in the Admin Tools.
I can open and build the project in VS 2005 in XP 64, this is OK.
But
I cannot debug it (it says debugging not enabled or something)
I cannot start it in IE, when I tried I got this
The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write
access to 'D:\WINDOWS\Microsoft.NET\Framework64\v2.0.50215\Temporary ASP.NET
Files'.
Now I dont want to go changing the access rights to this dir, this seems the
wrong way to go.
Now I may have had a bogus URL when I got the above message, I cant tell
which is actually correct because noen of my attempts work.
Also unlike in XP 32, the IIS folder has a new node (with a small yellow
gear wheel) for various "application" modules or assemblies (cant recall the
exact term).
So any guidance is much appreciatred.
If it is easier, I can redo the whole thing, the ASP web app is in a fodler
on my Drive C (the solution folder created when running Win32).
So if it ieasier to start again, then please explain the steps, do I
manually create a virtual dir? do I run the "Publish" option in the IDE or do
si do something else?
What I want is to be able to work on the project source from either the Win
32 or the Win 64 boot, with each OS having its own IIS so I can access the
site whichever OS I have booted.
Many tahnks
Hugh Tag: stop session Tag: 312870
Check Each Character of a String?
Hello,
What is the best way to check each character within a string?
For doing something like encryption, where you check character 1 and replace
it with a different character.. then check character 2 and replace it with a
different character.... etc.... until completing the string?
thanks.... Tag: stop session Tag: 312865
Server Permission Settings
Hello,
I'm not sure if I'm in the right area. I have asp pages that call a
database and sometimes updates it. The pages are under the root the database
is in a db folder under the root. My server guy isn't too sure what the
permissions should be on the server to these folders (root & db). Can you
give me some general instructions for this? Or point me in the right
direction for the answer?
Thanks Tag: stop session Tag: 312856
intellisense stopped working on COM objects
I was using intellisense for several registered com objects on my box
when one day out of the blue they stop working.. i still get
intellisense on some com and microsoft standard objects but others just
quit working.
I have tried unregistering and reregistering the objects but no dice. Tag: stop session Tag: 312854
Selected
Hi,
Why do not working selected?
Thx
<% myarray = array("2000", "2001", "2002", "2003", "2004", "2005", "2006",
"2007")
year = DatePart("YYYY", Date)
Response.Write "<select name=""year"" class=""form"">"
For i = 0 To 7
Response.Write "<option value='" & myarray(i) & "'"
' this lines
if myarray(i) = year then
Response.Write " selected"
End if
' this lines
Response.Write ">"
Response.Write myarray(i) & "</option>" & vbcrlf
Next
Response.Write "</select>" & vbcrlf
%> Tag: stop session Tag: 312821
isNumeric()
I have received the following feedback for the two functions bellow:
"The ISNUMERIC test is WORTHLESS for checking for an INT value, because
ISNUMERIC will happily accept DOUBLE values, such as 89.11998811777 and
other values that are simply *NOT* INT values."
<%
function isZip(input)
isZip = false
if len(input) = 5 then
isZip = (isNumeric(input))
end if
if len(input) = 10 then
z1 = left(input,5)
z2 = right(input,4)
z3 = mid(input,6,1)
isZip = (isNumeric(z1) and isNumeric(z2) and z3="-")
end if
end function
function isPhone(input)
Dim tempPh
tempPh = replace(input," ","")
tempPh = replace(input,"-","")
tempPh = replace(input,"-","")
tempPh = replace(input,"(","")
tempPh = replace(input,")","")
isPhone = (isNumeric(tempPh))
end function
%>
How do I solve the problem?.
Your help is kindly appreciated.
Regards
Eugene Anthony
*** Sent via Developersdex http://www.developersdex.com *** Tag: stop session Tag: 312818
How to close a IE page without any alart?
I use window object with close method to close a web page, this web page is
designed by active server page and VBscript. the code is as follows:
window.close()
however, an alart messege comes from IE. It's details: The Web page you are
viewing is trying to close the windows. Do you want to close this windows?
I want to directly close the window without any alart messege. In VBA, we
can add a declare Application.displayalart =false.
How to do this in html or VBA?
Thanks.
--
Developer
QA Dashboard
Microsoft China Development Centre Tag: stop session Tag: 312814
Cannot create web project
I am trying to create a web project in Visual InterDev.
I get the message: "Cannot create a disk-based web application in
C:\InetPub\wwwroot\Project1\Project1_local. You cannot configure
C:\InetPub\wwwroot\Project1\Project1_local as a frontpage web because the
dirctory C:\InetPub\wwwroot\Project1 above it is already configured as a
frontgae web. You can open that web instead."
Does anyone have any idea what is going on here? Tag: stop session Tag: 312812
asp and ms sql
This is a table created in ms sql:
create table customer
(
CustomerID int IDENTITY,
FirstName varchar(25),
LastName varchar(25),
CompanyName varchar(25),
Phone int,
Email varchar(20),
Password varchar(20),
Address varchar(30),
Zip int,
StateID varchar(30),
City varchar(30),
CountryID varchar(30),
CustomerTypeID varchar(30),
Session varchar(30),
IP varchar(30),
LastUpdate Smalldatetime
)
This is the stored procedure created in ms sql:
Create Procedure usp_InsertCustomer
@FirstName varchar(25),
@LastName varchar(25),
@CompanyName varchar(25),
@Phone int,
@Email varchar(20),
@Password varchar(20),
@Address varchar(30),
@Zip int,
@StateID varchar(30),
@City varchar(30),
@CountryID varchar(30),
@CustomerTypeID int,
@IP varchar(20)
AS SET NOCOUNT ON
Declare @sessionID AS UNIQUEIDENTIFIER
Declare @session AS varchar(255)
set @sessionID = NEWID()
set @session = convert(varchar(255),@SessionID)
INSERT INTO Customer
FirstName,LastName,CompanyName,Phone,Email,Password,Address,Zip,StateID,
City,CountryID,CustomerTypeID,Session,IP,LastUpdate
VALUES(@FirstName,@LastName,@CompanyName,@Phone,@Email,@Password,@Addres
s,@Zip,@StateID,@City,@CountryID,@CustomerTypeID,@session,@IP,GETDATE())
In my RegistrationExec.asp I have the following code:
<!--#include file="database_Function.asp"-->
<!--#include file="string_Function.asp"-->
<!--#include file="validateField_Function.asp"-->
<%
firstname = formatforDb(getUserInput(Request.Form("textfield1")))
lastname = formatforDb(getUserInput(Request.Form("textfield2")))
companyname = formatforDb(getUserInput(Request.Form("textfield3")))
phone = formatforDb(getUserInput(Request.Form("textfield4")))
email = formatforDb(getUserInput(Request.Form("textfield5")))
password = formatforDb(getUserInput(Request.Form("textfield6")))
address = formatforDb(getUserInput(Request.Form("textfield7")))
zip = formatforDb(getUserInput(Request.Form("textfield8")))
state = formatforDb(getUserInput(Request.Form("select1")))
otherstate = formatforDb(getUserInput(Request.Form("textfield9")))
city = formatforDb(getUserInput(Request.Form("textfield10")))
country = formatforDb(getUserInput(Request.Form("select2")))
if isLength(firstname) = false then
response.redirect "error_msg?msg=Please fill in the first name."
end if
if isLength(lastname) = false then
response.redirect "error_msg?msg=Please fill in the last name."
end if
if isLength(companyname) = false then
response.redirect "error_msg?msg=Please fill in the company name."
end if
if isLength(phone) = false then
response.redirect "error_msg?msg=Please fill in the phone number."
end if
if isLength(email) = false then
response.redirect "error_msg?msg=Please fill in the email address."
end if
if isLength(password) = false then
response.redirect "error_msg?msg=Please fill in the password."
end if
if isLength(address) = false then
response.redirect "error_msg?msg=Please fill in the address."
end if
if isLength(zip) = false then
response.redirect "error_msg?msg=Please fill in the zip code."
end if
if (isLength(state) = true AND isLength(otherstate) = true) OR
(isLength(state) = false AND isLength(otherstate) = false) then
response.redirect "error_msg?msg=Please fill in or select a state."
end if
if isLength(city) = false then
response.redirect "error_msg?msg=Please fill in the city."
end if
if isLength(country) = false then
response.redirect "error_msg?msg=Please select a country."
end if
if isEmail(email) = false then
response.redirect "error_msg?msg=You have entered an invalid email
address."
end if
if isZip(zip) = false then
response.redirect "error_msg?msg=You have entered an invalid zip code."
end if
if isPhone(phone) = false then
response.redirect "error_msg?msg=You have entered an invalid phone
number."
end if
Dim Temp
if isEmpty(state) then
Temp = otherstate
else
Temp = state
end if
mySQL = "EXECUTE usp_InsertCustomer @FirstName='" & firstname &
"',@LastName='" & lastname & "',@CompanyName='" & companyname &
"',@Phone='" & phone & "',@Email='" & email & "',@Password ='" &
password & "',@Address='" & address & "',@Zip='" & zip & "',@StateID='"
& "kl" & "',@City='" & city & "',@CountryID='" & country &
"',@CustomerTypeID=" & CInt(1) & ",@IP='" &
Request.ServerVariables("REMOTE_HOST") & "'"
call updateDB(mySQL, rs)
rs.close()
CloseDB()
%>
I am getting this error:
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E57)
String or binary data would be truncated.
/Mix/database_Function.asp, line 15
How do I solve this problem?.
Your help is kindly appreciated.
Regards
Eugene Anthony
*** Sent via Developersdex http://www.developersdex.com *** Tag: stop session Tag: 312802
Various path/path/files.asp all #include this 1 file
Ok, I give up.
I need to #include the same 1 file (IncludeThis.asp) into 3 different asp
files.
1> C:\MyDir\ThisFile.asp
2> D:\MyDir\AASubSub\ThatFile.asp
3> E:\MyDir\CCSub\DDSubSub\AnotherFile.asp
On another server... those same 3 files... need to include
their own local copy of IncludeThis.asp
4> D:\EEDir\ThisFile.asp
5> E:\FFDir\GGSubSub\ThatFile.asp
6> F:\HHDir\IISub\JJSubSub\AnotherFile.asp
Is there a way I can make an #include statement that I can
put in the files... that will still find the IncludeFile.asp... regardless
of the different drives, different paths, different levels of dir nesting?
(Base filenames 1,2,3... are the same as 4,5,6, respectively.)
The include-file will always be called IncludeThis.asp
(Where should I put it?) Tag: stop session Tag: 312801
DLL!
I created a simple DLL in VB 6.0 & successfully registered it with the
following command at the Command Prompt:
regsvr32 c:\Inetpub\wwwroot\FetchRecords.dll
I am accessing the DLL in an ASP page with the following code:
<%
Dim strProduct
strProduct=Request.QueryString("product")
Dim objProduct
Set objProduct=Server.CreateObject("FETCH.RECORDS")
objProduct.setString(strProduct)
Response.Write("Price of " & strProduct & " is $")
Response.Write(objProduct.retrieveRecords())
Set objProduct=Nothing
%>
But the above code, when executed, throws a "Invalid ProgID" error.
Where am I going wrong? Please note that registering the DLL using
regsvr32 throws a
DllRegisterServer in c:\Inetpub\wwwroot\FetchRecords.dll succeeded.
message implying that the DLL has registered successfully. In order to
ensure that the component has really been installed in my system, I
executed the following script:
<%
If(IsObject(Server.CreateObject("FETCH.RECORDS"))) Then
Response.Write("Component Installed!")
Else
Response.Write("Component Not Installed!")
End If
%>
but strangely, the above script also generates the "Invalid ProgID"
error. Why so though the DLL has registered successfully (as the DOS
message suggests)?
Lastly, can DLLs be created using VS.NET 7.0 in the same way as they
can be created using VB 6.0?
Thanks,
Arpan Tag: stop session Tag: 312800
Creating 'vanity' domain names on the fly
Hi - Any help or pointer on this would be greatly appreciated. I'm
working on something similar to blogger.com. Users sign up and they get
their own webpage, with a domain name of 'username.blogger.com'.
Since blogger.com is doing it on the fly (as you sign up), I'm sure
they are doing it programmatically. Anyone has any clue on how they do
that?
Cheers,
Steve. Tag: stop session Tag: 312797
returning date with two digit year
I have a field that is stored in SQL Server in date/time format. On one
page, I only need the date to display. I am able to do this by saying:
DateValue(strLastModified)
However, this returns to me the date in this format:
05/10/2004
Instead, I would like to see:
05/10/04, but I am not sure how to do this. Tag: stop session Tag: 312776
DateTime in Paramtized asp query?
How does one paramtized a date in asp for a stored procedure that is
expecting DateTime?
if oRS.eof then
'// SAFE TO INSERT STORY....
CREATE Procedure spr_AddStory
oCmd.Parameters.append oCmd.CreateParameter("StoryTitle", adVarChar,
adParamInput,100,pStoryTitle)
oCmd.Parameters.append oCmd.CreateParameter("StoryDate datetime,
'//??????????????)
Thanks
Jason Tag: stop session Tag: 312767
Fine-tune/improve Parametized query in asp?
I am trying to improve the robustness and elegance of my parametized sql
statements in ASP 3.0 as they get passed to the sql server SP.
Could anyone tell me if there are weaknessess in the way I have written the
following code? I have included both the asp code and the sql stored
proceducre to tie things togoether....I appreciate any advice on this. It
basically is a application to manage static news stories on our site by
tracking and organising the meta data in a table.
Many thanks for you comments.
ASP PARAMERT QUERY
----------------------------
If oRS.eof then
'// SAFE TO INSERT STORY....
CREATE Procedure spr_AddStory
oCmd.Parameters.append oCmd.CreateParameter("StoryTitle", adVarChar,
adParamInput,100,pStoryTitle)
oCmd.Parameters.append oCmd.CreateParameter("StoryURL", adVarChar,
adParamInput,150,pStoryURL)
oCmd.Parameters.append oCmd.CreateParameter("StoryBlurb", adVarChar,
adParamInput,1200, PStoryURL)
oCmd.Parameters.append oCmd.CreateParameter("StoryBrokerID int", adInteger,
adParamInput,4,pStoryBrokerID)
oCmd.Parameters.append oCmd.CreateParameter("StoryCompanyID int", adInteger,
adParamInput,4,pStoryCompanyID)
oCmd.Parameters.append oCmd.CreateParameter("StoryCategoryID int",
adInteger, adParamInput,4,pStoryCategoryID)
oCmd.Parameters.append oCmd.CreateParameter("StoryDeptID int", adInteger,
adParamInput,4,pStoryDeptID)
oCmd.Parameters.append oCmd.CreateParameter("StoryKeyword1", adVarChar,
adParamInput,50,pStoryKeyword1)
oCmd.Parameters.append oCmd.CreateParameter("StoryKeyword2", adVarChar,
adParamInput,50,pStoryKeyword2)
oCmd.Parameters.append oCmd.CreateParameter("StoryKeyword3", adVarChar,
adParamInput,50,pStoryKeyword3)
oCmd.Parameters.append oCmd.CreateParameter("RelatedURL1", adVarChar,
adParamInput,150,pRelatedURUL1)
oCmd.Parameters.append oCmd.CreateParameter("RelatedURL2", adVarChar,
adParamInput,150,pRelatedURUL1)
oCmd.Parameters.append oCmd.CreateParameter("RelatedURL3", adVarChar,
adParamInput,150,pRelatedURUL1)
oCmd.Parameters.append oCmd.CreateParameter("StoryDate datetime,
oCmd.Parameters.append oCmd.CreateParameter("StoryImageURL", adVarChar,
adParamInput,150,pStoryImageURL)
oCmd.Parameters.append oCmd.CreateParameter("StoryBLN int", adInteger,
adParamInput,4,pStoryBLN)
set oReturn = oCmd.CreateParameter("u_id", adInteger, adParamOutput)
oCmd.Parameters.append oReturn
oCmd.execute()
'//RESULT...
if oReturn.value=-1 then
Response.write "FAILURE: Insert statement could not be carried out"
response.end
else
Response.write "SUCCESS: Insert statement was successfull"
End if
SQL SERVER STORED PROCEDURE
-------------------------------------------
CREATE Procedure spr_AddStory
@StoryTitle varchar(100),
@StoryURL varchar(150),
@StoryBlurb varchar(1200),
@StoryBrokerID int,
@StoryCompanyID int,
@StoryCategoryID int,
@StoryDeptID int,
@StoryKeyword1 varchar(50),
@StoryKeyword2 varchar(50),
@StoryKeyword3 varchar(50),
@RelatedURL1 varchar(150),
@RelatedURL2 varchar(150),
@RelatedURL3 varchar(150),
@StoryDate datetime,
@StoryImageURL varchar(150),
@StoryBLN int
AS
INSERT INTO Story (StoryTitle, StoryURL, StoryBlurb, StoryBrokerID
,
StoryCompanyID, StoryCategoryID, StoryDeptID, StoryKeyword1, StoryKeyword2,
StoryKeyword3, RelatedURL1, RelatedURL2, RelatedURL3, StoryDate,
StoryImageURL, StoryBLN)
VALUES
(@StoryTitle,@StoryURL,@StoryBlurb,@StoryBrokerID,@StoryCompanyID,@StoryCategoryID,@StoryDeptID,@StoryKeyword1,@StoryKeyword2,@StoryKeyword3,
@RelatedURL1,@RelatedURL2,@RelatedURL3,@StoryDate,@StoryImageURL,@StoryBLN)
GO Tag: stop session Tag: 312764
Downloading files of known mime type
I am attempting to write an ASP page that will download a file rather then
open it, when it is of known type. I found this code here:
http://mosley.arach.net.au/dev/docs/save%20as.htm
The first example works fine, for files under 5 Mb, the second example
downloads the file but the data is corrupted. Using a JGP file as a
reference, it seems to corrupt the end of the file (since the bottom of the
JPEG is corrupted).
Here is the code I am using. Any idea how to fix this? or an alternative
method?
Response.ContentType = "application/x-unknown"
Response.AddHeader "content-disposition","attachment; filename=" &
Request.QueryString("File")
Set adoStream = CreateObject("ADODB.Stream")
chunk = 2048
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(Server.MapPath(vFilePath))
iSz = adoStream.Size
Response.AddHeader "Content-Length", iSz
For i = 1 To iSz \ chunk
If Not Response.IsClientConnected Then Exit For
Response.BinaryWrite adoStream.Read(chunk)
Next
If iSz Mod chunk > 0 Then
If Response.IsClientConnected Then
Response.BinaryWrite objStream.Read(iSz Mod chunk)
End If
End If
adoStream.Close
Set adoStream = Nothing
Response.End Tag: stop session Tag: 312762
Detecting a file upload
Hi all.
I have a form that also allows an image to be uploaded.
<input type="file" name="Upload">
How can I detect if a file has been uploaded, example
if [upload has been made] then
Do thing A
else
Do thing B
end if
Thanks for any pointers Tag: stop session Tag: 312761
connecting to localhost
Hi,
I have got a scenario where an asp script needs to request via xmlhttp a
file sitting on the same server. The code all works find on my local
machine. However, on the hosting server, it does not. The problem is
that I am on a shared server and the server can't "see itself", i.e.
it's probably blocked by the host to receive request from itself. The
problems comes in as the server will hold multiple sites and use host
headers to channel request. I thought of using "localhost" and some kind
of header sending scenario to get the server to go to the correct
subfolder/virtual host. However, googling has not brought up much. Has
anyone got ideas/similar scenarios and could point me in some helpful
directions?
Thanks
Christoph Tag: stop session Tag: 312760
Object doesn't support this property or method: 'Response.Redirect
I wanted to add this method to my .asp page in order to dynamically choose a
page based upon some selection criteria. It's in my .asp book and in the
online reference. Yet when I use this object, the following error returns
in the browser:
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'Response.Redirect'
/testwebs/choose.asp, line 22
What is missing from my IIS libraries in order to use have this method
supported?
Thanks for any info
/peter d. Tag: stop session Tag: 312750
why use htmlencode
Hi
I have a website where people can enter comments into a textarea - some of
these may have a bit of html - like links - or <blockquote>
the comments are stored in a Access2000 mdb file - A friend told me that i
have to use htmlencode on the textarea string before storing it in the
database. but it seems to work fine without doing this - is there any reason
as to why i should put it thru htmlencode?
when the comments are displayed they are written straight into a <div>
<div><%=recset.fields("comments")%></div>
thanks in advance
Diablo Tag: stop session Tag: 312743
error with aspnet_isapi.dll
Win2k server that recent;y had a virus (fixed by client so I don't know
which one it was) is filling the event log with this error:
7/6/2005,4:39:07 PM,Perflib,Error,None,1008,N/A,SERVER,"The Open Procedure
for service ""ASP.NET_1.1.4322"" in DLL
""C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll"" failed.
Performance data for this service will not be available. Status code
returned is data DWORD 0. "
They didn't have SP4 installed so I had them install that but they tell me
that the logging continues. Perfmon isn't running so what else could cause
this error? I am going to TS into their machine tonight after closing so I
am looking for ideas. I searched the KB and didn't find anything this
specific. Perhaps reinstalling the framework will fix it?
thanks for any help. Tag: stop session Tag: 312731
How do I detect which button was clicked on "save/open/cancel" dialog?
When users clicked a unkown mime type link such as Zip on my website, a
"Save/Open/Cancel" dialog box pops up. Is there a way to detect which button
users clicked by using ASP? actually I only what to record the "valid"
click -- when Open/Save was clicked.
Thanks ahead.
Quinn Tag: stop session Tag: 312730
error with aspnet_isapi.dll
Win2k server had a virus, I don't know which one as the client removed it
themselves, but the event log is filling with this error:
7/6/2005,4:39:07 PM,
Perflib
Error
None1008,N/A,SERVER,"The Open Procedure for service ""ASP.NET_1.1.4322"" in
DLL ""C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll"" failed.
Performance data for this service will not be available. Status code
returned is data DWORD 0. " Tag: stop session Tag: 312729
Having Web Page Refresh and go to end of page
I am trying to use the following to get a web page to auto refresh every 3
secs and go to the end of the web page. Refresh works but it will not jump
to the name anchor. Any help?
<HTML>
<HEAD>
<META http-equiv="REFRESH" content="3;'what.htm#TheEnd'">
</HEAD>
<BODY bgcolor="#ffffff" text="#000000">
<CENTER>
<TABLE width="600">
<TR>
<TD vAlign=top align=left>
Tons o content
</TD>
</TR>
</TABLE>
</CENTER>
<A name="TheEnd">You Are At The End</A>
</BODY>
</HTML> Tag: stop session Tag: 312724
How do I get ASP (SOAPtoolkit3) to query NTLM authenticated .NETWe
Hi there,
I am needing to query a .NET webservice from a classic ASP page. It works
absolutely fine under anonymous authentication however I want to turn NTLM
authentication on in order for me to ascertain the requesting user's context.
Detailed below is my code currently but it throws a very vague error when I
turn on NTLM authentication.
What is is that I am doing wrong and what do I need to do to get this
working...?
function callAuditService()
Dim oSOAP
Dim Result
Result = False
Set oSOAP = Server.CreateObject("MSSOAP.SoapClient30")
oSOAP.ClientProperty("ServerHTTPRequest") = True
oSOAP.mssoapinit(Application("AuditWebServicePath"))
oSOAP.ConnectorProperty("AuthUser") = Request.ServerVariables("AUTH_USER")
oSOAP.ConnectorProperty("ConnectTimeout") = 300000
Result = oSOAP.AuditSearch(ParametersInHere)
Set oSOAP = Nothing
callAuditService = Result
end function
Any help would be very muchly appreciated.
Thanks,
DC
--
</davidChristiansen> Tag: stop session Tag: 312713
I dont want to start the sessions when my asp page is run....how do I do
that...can I add something at the start of the page which will not enable
the session
abcd wrote:> I dont want to start the sessions when my asp page is
run....how do I> do that...can I add something at the start of the page
which will not> enable the session