473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

VBScript MsgBox: Trying to bypass permision denied error

1
Hello,

Im using ASP with VBScript.
At some point of the code of the application that Im making some changes, I need to get a confirmation from the user if he wants or not to send a confirmation e-mail for the action he performed.

Its simple, like this:

Expand|Select|Wrap|Line Numbers
  1. sendEmail = MsgBox("Send e-mail?",5,"Confirmation")
  2. if sendEmail = 6 then
  3.  
  4. Set objmail = Server.CreateObject("CDONTS.NewMail") 
  5.             objmail.from = trim(rs("EMAIL"))
  6.             objmail.Value("Reply-To") = trim(rs("EMAIL"))
  7.             objmail.to = trim(rs("EMAIL_RESPONSAVEL"))&";"&trim(rs("EMAIL_GRUPO"))
  8.             objmail.subject = trim(rs("EMAIL_ASSUNTO_FECHAMENTO_RESPONSAVEL"))&" "&trim(rs("NOME_TIPO_DOCUMENTO"))
  9.             objmail.body = texto 
  10.             objmail.BodyFormat = 0
  11.             objmail.Importance = 2    
  12.             objmail.MailFormat = 0            
  13.             objmail.send
  14.         set objmail = nothing
  15.  
  16. end if
rs is just a recordset with some data on.

The thing is like this, I get the old Permission Denied error..
So I tryed like that, that I dont know is its going to work or not until someone uses this part of the application:

Expand|Select|Wrap|Line Numbers
  1.         <SCRIPT language="VBScript">
  2.  
  3.         sendEmail = MsgBox("Send e-mail?",5,"Confirmation")
  4.  
  5.         if sendEmail = 6 then
  6.  
  7.         send = true
  8.  
  9.                                 end if
  10.  
  11.         </SCRIPT>
  12.  
  13.         <%
  14.  
  15.         if send = true
  16.  
  17.         Set objmail = Server.CreateObject("CDONTS.NewMail") 
  18.             objmail.from = trim(rs("EMAIL"))
  19.             objmail.Value("Reply-To") = trim(rs("EMAIL"))
  20.             objmail.to = trim(rs("EMAIL_RESPONSAVEL"))&";"&trim(rs("EMAIL_GRUPO"))
  21.             objmail.subject = trim(rs("EMAIL_ASSUNTO_FECHAMENTO_RESPONSAVEL"))&" "&trim(rs("NOME_TIPO_DOCUMENTO"))
  22.             objmail.body = texto 
  23.             objmail.BodyFormat = 0
  24.             objmail.Importance = 2    
  25.             objmail.MailFormat = 0            
  26.             objmail.send
  27.         set objmail = nothing
  28.  
  29.                                 end if
  30.         %>
Moving the MsgBox to run on the client side works, but I dont belive if the 'send' variable created in the client-side code will be seen by the code runned server-side.

Anyone know some way to get this working?

Thank you very much in advance!
Oct 7 '08 #1
2 5147
shweta123
692 Expert 512MB
Hi,

You can write the code to get the confirmation before sending the email at the client side using javascript function.
You can do this using following steps :

1> Create a hidden field in your ASP page and set the value of this hidden field to TRUE or FALSE using javascript function.
e.g.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name= "hidEmail">
2> Now , Write the javascript function in order to set the value of hidden field .

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function setEmail()
  3.     {
  4.       //set the hidden field Email
  5.       document.form1.hidEmail.value = confirm("Do you want to send email?");
  6.     }
  7. </script>
3> Call the above javascript function on the Submit button.
e.g.
Expand|Select|Wrap|Line Numbers
  1. <Input type = "Submit" onClick =  "setEmail();">
4> Retrieve the value of the hidden field on The ASP page in order to decide if Email should be sent or not.
e.g.
Expand|Select|Wrap|Line Numbers
  1. <%
  2.            Dim emailconfirm
  3.            emailconfirm = Request. Form("hidEmail")
  4.  
  5.            If(emailconfirm = TRUE) then
  6.                   '''''''''''''''Write the code for sending email   
  7.            End if
  8.            %>
Oct 7 '08 #2
I almost gave up on this before I made it work by using "true" instead of TRUE. Thought it might help someone else out. Otherwise, thanks for the useful info. My (working) code:

<%@ Language=VBscript%>
<%option Explicit%>

<script language = javascript type = text/javascript>
function SetDelCN(){
document.getElementById("DelCN").value = confirm("Are you sure you want to Delete?")
}</script>

<%

sub delcont
Dim DelContconfirm
DelContConfirm = Request("DelCN")
response.write(DelContConfirm) &"<BR>"
If(DelContConfirm = "true") then
response.write "delete the record" & "<BR>"
else
response.write "dont delete the record" & "<BR>"
end if
end sub

execute request("action")

%>

<html>
<head>
<title></title>
</head>
<body>

<form name=formx action=testconfirm.asp method=post>
<input type=hidden name=action value=DelCont>
<input type=hidden name= DelCN>
<input size = 3 type=submit name=delrec onclick = SetDelCN() value="Delete">
</form>

</body>
</html>
Feb 9 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Leszek | last post by:
Hello gurus! I wrote a code in VBS, that will check, that current user is in one from three groups. But i don't know how asimilate it with asp.net. This page will be a bridge between 2 - main...
1
by: Ana Rita | last post by:
Hello to all. I'm trying to do call a vbscript sub in one page aspx. My vbscript sub is in a file with the extension (vbs) and it looks like this: Sub Mens (strmens) Msgbox strmens
3
by: Joe Caverly | last post by:
Hi, I'm using Visual C++ 32-bit Professional Edition 5.0 Using Microsoft Knowledge Base Article 181473 as a basis, I'm trying to transform this VB Code; Dim sc As Object Dim code As String...
3
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set...
1
by: Sigfredo N. Jayme | last post by:
Good Day! Hello to everyone! I encountered some problems when i tried to debug my activeX dll (in process). This is the scenario. 1.I created a simple activex dll called myproject.dll. I...
3
by: avenpace | last post by:
Hi I have python cgi script, but when I call it I got server internal error. The log in my apache is (13)Permission denied: exec of '/srv/www/cgi-bin/helo.cgi' failed Premature end of...
3
by: Snow | last post by:
Hello: I have Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: '' The error happened at this line: if session("systemIdCount" & arrSystems(iLoop)) 0 The code like this:
0
AHMEDYO
by: AHMEDYO | last post by:
hi all, first its my first time to post question in internet, but vbs really let me crazy. my problem is : ---------------------- i wanna to transfer exe file to machine that i can access by...
5
by: MicheleG | last post by:
Hi to all! I created a VB.Net COM DLL which I can use in VBScript. I followed the steps in the following article: http://msdn2.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx (I used the method...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.