This my code
Dim verifyUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) & Page.ResolveUrl("~/verify.aspx?ID=" & sGUID)
mail.Body = "<html>" & _
"<head>" & _
"<meta http-equiv=""Content-Language"" content=""fr"">" & _
"<meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1252"">" & _
"</head>" & _
"<body>" & _
" <p>Hello, <%UserName%>. You are receiving this email because you recently created a new account at my" & _
"site. Before you can login, however, you need to first visit the following link:</p>" & _
"<p> //////Here put an href whit the value verifyUrl ///// </p>" & _
"</body>" & _
"</html>"
mail.Body = mail.Body.Replace("<%VerifyUrl%>", verifyUrl)
mail.Body = mail.Body.Replace("<%UserName%>", nom)
Try for long time to put an like <a href"<%verifyUrl%>"</a> but this not work well................
Please help me to enter this simple html line!!!
Thanks in advance!!
You can use this:
<a href='<%VerifyUrl%>'>Click Here</a>
Related
I'm trying to register a new user in an SQL Server DB, from Classic ASP
I appreciate the Classic ASP is antiquated, but I familiar with it and it does the job I need to to (generally).
Here's the code...
<%
Set rs = CreateObject("ADODB.Recordset")
Set con = Server.CreateObject("ADODB.Connection")
con.ConnectionString="Provider=SQLOLEDB;" & _
"Server=Server\SQLEXPRESS;" & _
"Uid=IUSR;" & _
"Pwd=Pwd;" & _
"Database=DB"
con.Open
username="username"
password="password"
tsql="CREATE TABLE #newUserTable(UserID int); " & vbCrLf & _
"DECLARE #responseMessage NVARCHAR(50); " & vbCrLf & _
"DECLARE #userID INT; " & vbCrLf & _
"IF EXISTS (SELECT TOP 1 UserID FROM [dbo].[UserLogins] WHERE LoginName='" & username & "') " & vbCrLf & _
"BEGIN " & vbCrLf & _
"SET #responseMessage='User already exists' " & vbCrLf & _
"END " & vbCrLf & _
"ELSE " & vbCrLf & _
"BEGIN " & vbCrLf & _
"DECLARE #salt UNIQUEIDENTIFIER=NEWID(); " & vbCrLf & _
"BEGIN TRY " & vbCrLf & _
"INSERT INTO dbo.UserLogins (LoginName,PasswordHash,Salt) " & vbCrLf & _
"OUTPUT INSERTED.UserID INTO #newUserTable " & vbCrLf & _
"VALUES ('" & username & "',HASHBYTES('SHA2_512', '" & password & "'+CAST(#salt AS NVARCHAR(36))),#salt); " & vbCrLf & _
"SET #responseMessage=" & vbCrLf & _
"CAST((SELECT userID FROM #newUserTable) AS NVARCHAR(50)); " & vbCrLf & _
"END TRY " & vbCrLf & _
"BEGIN CATCH " & vbCrLf & _
"SET #responseMessage=ERROR_MESSAGE() " & vbCrLf & _
"END CATCH " & vbCrLf & _
"END " & vbCrLf & _
"SELECT #responseMessage AS N'responseMessage'; " & vbCrLf & _
"DROP TABLE #newUserTable"
'response.write tsql & "<hr />"
rs.open tsql, con
response.write rs("responseMessage")
rs.close
%>
When I attempt to add an existing user, I get the expected User already exists response, but when I attempt to add a new user, I get Item cannot be found in the collection corresponding to the requested name or ordinal which suggests that rresponseMessage doesn't exist. If I output the tsql to the browser (replacing vbCrLf with "") and run it in SQL Server, I get the userID returned as responseMessage as I would expect.
Can anyone suggest why this might be, and how I can correct it?
Change your last command to SELECT #responseMessage AS N'responseMessage' (instead of the Drop).
You can also try using "SET NOCOUNT ON" to avoid count messages messing your results.
Also, you don't need to add vbCrLf to TSQL
Your code should look like this:
tsql="SET NOCOUNT ON; " & _
"CREATE TABLE #newUserTable(UserID int); " & _
"DECLARE #responseMessage NVARCHAR(50); " & _
"DECLARE #userID INT; " & _
"IF EXISTS (SELECT TOP 1 UserID FROM [dbo].[UserLogins] WHERE LoginName='" & username & "') " & _
"BEGIN " & _
"SET #responseMessage='User already exists' " & _
"END " & _
"ELSE " & _
"BEGIN " & _
"DECLARE #salt UNIQUEIDENTIFIER=NEWID(); " & _
"BEGIN TRY " & _
"INSERT INTO dbo.UserLogins (LoginName,PasswordHash,Salt) " & _
"OUTPUT INSERTED.UserID INTO #newUserTable " & _
"VALUES ('" & username & "',HASHBYTES('SHA2_512', '" & password & "'+CAST(#salt AS NVARCHAR(36))),#salt); " & _
"SET #responseMessage=" & _
"CAST((SELECT userID FROM #newUserTable) AS NVARCHAR(50)); " & _
"END TRY " & _
"BEGIN CATCH " & _
"SET #responseMessage=ERROR_MESSAGE() " & _
"END CATCH " & _
"END " & _
"DROP TABLE #newUserTable" & _
"SELECT #responseMessage AS N'responseMessage'; "
I'm working on a rss feed reader and seems so work great.
The only thing that I seem not to get working is to read the image in the feed.
<itunes:image href="http://www.itunes.com/image.jpg"/>
Can anyone help?
This is a part of my code.
For Each objItem in objItems
On Error Resume Next
TheTitle = objItem.selectSingleNode("title").Text
TheLink = objItem.selectSingleNode("image").Text
Theimg = objItem.SelectSingleNode("itunes").Attributes(":image").InnerText
Response.Write "<div class='article'>" &_
"<a href=" & TheLink & ">" & _
"<span>" & Theimg & TheTitle & "</span>" & _
"</a>" & _
"</div>"
Next
Your image address needs to go inside an image tag
Response.Write "<div class=""article"">" &_
"<a href=""" & TheLink & """>" & _
"<img src=""" & Theimg & """ alt=""" & TheTitle & """ />" & _
"</a>" & _
"</div>"
If you're wondering why all the double quotes, see this question
Adding quotes to a string in VBScript
As an aside, if you understand XSL then I find that the best way to handle RSS feeds in Classic ASP is to do a server side XSLT transformation. The ASP looks like this
set xml = Server.CreateObject("Msxml2.DomDocument.6.0")
xml.setProperty "ServerHTTPRequest", true
xml.async = false
xml.validateOnParse = false
xml.load("http://your-rss-feed")
set xsl = Server.CreateObject("Msxml2.DomDocument.6.0")
xsl.load(Server.Mappath("yourxslfile.xsl"))
Response.Write(xml.transformNode(xsl))
set xsl = nothing
set xml = nothing
How do I get my Asp.net webapi to return the correct response for a pdf form submit?
To keep the response inside of the pdf application you must return an FDF formatted file.
The key to get this to work is that you cannot just return a string. You must first encode it to a memory stream and the header must be set to application/vnd.fdf.
Here is the example code:
Public Function PostValue(<FromBody()> ByVal value As MyPDFFieldsObject) As HttpResponseMessage
Dim fdfmessage As String = "%FDF-1.2" & vbCrLf & _
"1 0 obj <<" & vbCrLf & _
"/FDF <<" & vbCrLf & _
"/Status (Submitted Successfully!)" & vbCrLf & _
">>" & vbCrLf & _
">>" & vbCrLf & _
"endobj" & vbCrLf & _
"trailer" & vbCrLf & _
"<</Root 1 0 R>>" & vbCrLf & _
"%%EOF"
Dim result As HttpResponseMessage = New HttpResponseMessage(HttpStatusCode.OK)
Dim stream As New MemoryStream(Encoding.UTF8.GetBytes(fdfmessage))
stream.Position = 0
result.Content = New StreamContent(stream)
result.Content.Headers.ContentType = New MediaTypeHeaderValue("application/vnd.fdf")
Return result
End Function
Im trying to call de GetVerifiedStatus API.
Im using a server with Windows 7.
Can anyone help me plz.
This is my code:
Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim strRequest, strResult, strURL
strURL = "https://svcs.paypal.com/AdaptiveAccounts/GetVerifiedStatus"
strRequest ="<?xml version=""1.0"" encoding=""utf-8""?>" _
& "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/""" _
& " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" _
& " <SOAP-ENV:Header>" _
& " <RequesterCredentials xmlns=""urn:ebay:api:PayPalAPI"" xsi:type=""ebl:CustomSecurityHeaderType"">" _
& " <Credentials xmlns=""urn:ebay:apis:eBLBaseComponents"" xsi:type=""ebl:UserIdPasswordType"">" _
& " <Username>XXXX</Username>" _
& " <Password>XXXX</Password>" _
& " <Signature>XXXX</Signature>" _
& " <Subject>XXXX</Subject>" _
& " </Credentials>" _
& " </RequesterCredentials>" _
& " </SOAP-ENV:Header>" _
& " <SOAP-ENV:Body>" _
& " <Version xmlns=""urn:ebay:apis:eBLBaseComponents"">98.0</Version>" _
& " <emailAddress xs:""string"">john#gmail.com</emailAddress>" _
& " <firstName xs:""string"">John</firstName>" _
& " <lastName xs:""string"">Vegas</lastName>" _
& " <matchCriteria xs:""string"">NAME</matchCriteria>" _
& " <requestEnvelope common:""RequestEnvelope"">" _
& " <detailLevel xs:""string"">ReturnAll</detailLevel>" _
& " <errorLanguage xs:""string"">en_US</errorLanguage>" _
& " </requestEnvelope>" _
& " </SOAP-ENV:Body>" _
& "</SOAP-ENV:Envelope>"
objXMLHTTP.open "post", "" & strURL & "", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.setRequestHeader "SOAPAction", strURL
objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText
response.write strResult
Im receiving this error:
msxml3.dll erro '800c0008'
Failed to download the specified resource
At objXMLHTTP.send(strRequest) line.
When I changed my http object to MSXML2.ServerXMLHTTP, returns a error that said:
A certified is necessary to complete the client authentication.
Tks.
You can use Call objXMLHTTP.send(strRequest) instead of objXMLHTTP.send(strRequest)
I am not sure but you can try this because i found this from Classic ASP tutorial for payment gatway.
Here is the link for that: http://jadendreamer.wordpress.com/2009/09/02/classic-asp-soap-request-code-example
I tried everything, but nothing seems to work!
How the do I put a breakline?!
Dim textMsg as String
textMsg = Body.text & Environment.Newline & _ q1.text & Environment.Newline & _ q2.text & Environment.Newline & _ q3.text & Environment.Newline & _ q4.text '
please help
(with corrent code I get an error cuz of the & Environment.Newline & _ ")
Since you tagged this asp.net, I'll guess that this newline should appear in a web page. In that case, you need to remember that you are creating html rather than plain text, and html ignores all whitespace... including newlines. If you view the source for your page, you'll likely see that the new lines do make it to your html output, but they are ignored, and that's what is supposed to happen. If you want to show a new line in html, use a <br> element:
textMsg = Body.text & "<br>" & _ q1.text & "<br>" & _ q2.text & "<br>" & _ q3.text & "<br>" & _ q4.text
The code above will place the text on several lines. It's interesting that if you view the source now, you'll see that everything is all on the same line, even though it uses several lines for display.
You should add a br:
textMsg = Body.text & "<BR/>" & _ q1.text & "<BR/>" & _ q2.text & "<BR/>" & _ q3.text & "<BR/>" & _ q4.text
Or you can try:
Str & VBNewLine OR Str & VBCrLf
Or set the email message to html. The the will work.
thats the right one:
& (vbCrLf) &
Try this:
dim textMsg as String
textMsg = Body.text & vbNewLine
I preffer .Net Style:
& Environment.NewLine &
It's Is exactly the same that
& (vbCrLf) &