473,804 Members | 5,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBScript MsgBox: Trying to bypass permision denied error

1 New Member
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 5171
shweta123
692 Recognized Expert Contributor
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
jim bradshaw
4 New Member
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=VBscri pt%>
<%option Explicit%>

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

<%

sub delcont
Dim DelContconfirm
DelContConfirm = Request("DelCN" )
response.write( DelContConfirm) &"<BR>"
If(DelContConfi rm = "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=testconf irm.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
2131
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 menu and report page. Tomorrow to the 8 a.m. i must do this, but i don't know how.... Can someone help me? There are few messageboxes for help. Here is my code (it's vbs):
1
396
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
7035
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 Set sc = CreateObject("ScriptControl") sc.Language = "VBScript"
3
3348
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 o=getobject(,"ConsoleApplication2.Program") msgbox o.TestString
1
1576
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 added INitINIFile class. Within that class, I created a Function called 'Read_INI'.
3
1649
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 script headers: helo.cgi caught SIGTERM, shutting down
3
30917
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
1856
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 real ip no VPN and i cant access machine sharing but i can remote to this machine using remote desktop, sure u will ask me for download, but this machine cant go online because of physical security and firewall. i was think about 2 solution 1-i...
5
4027
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 "with COM class template") My DLL got created fine - no errors in build process. The "Make Assembly COM-Visible" checkbox is checked.
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10577
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7620
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.