Click here to Skip to main content
15,889,876 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Beginner Pin
suppubale4-Oct-14 1:49
suppubale4-Oct-14 1:49 
AnswerRe: Beginner Pin
Swinkaran5-Oct-14 12:22
professionalSwinkaran5-Oct-14 12:22 
AnswerRe: Beginner Pin
Dominic Burford8-Oct-14 3:56
professionalDominic Burford8-Oct-14 3:56 
QuestionHow do I POST back a specific header Pin
Wombaticus30-Sep-14 2:41
Wombaticus30-Sep-14 2:41 
AnswerRe: How do I POST back a specific header Pin
jkirkerx30-Sep-14 9:24
professionaljkirkerx30-Sep-14 9:24 
GeneralRe: How do I POST back a specific header Pin
Wombaticus30-Sep-14 22:42
Wombaticus30-Sep-14 22:42 
GeneralRe: How do I POST back a specific header Pin
jkirkerx1-Oct-14 5:53
professionaljkirkerx1-Oct-14 5:53 
QuestionRegarding PDF Converted file Pin
Member 1105767029-Sep-14 21:14
Member 1105767029-Sep-14 21:14 
i have a project where the client has to place a purchase order, when the client save the purchase order it moves to a aspx web page there the purchase order is displaced as image file, with two button one to generate PDF and the next To Send EMAIL

i can generate a pdf when pdf button is clicked and it get downloaded when opening the pdf file its someother pdf file.i mean the generated pdf is not getting download insist of that another purchased order pdf details is seen but with current file name. i dont know what i did work in my coding, my coding is

Inherits System.Web.UI.Page
Private obj As New SqlHelper
Private _i As Integer = 1
Private att As String
Private PONO1 As Integer
Private pat As String
Private Att_ As String

'Private MailPoId As String
'Private objApp As Outlook.Application = Nothing
'Private objMail As Outlook.MailItem = Nothing
'Private Declare Function ShellExecute Lib _
' "shell32.dll" Alias "ShellExecuteA" _
' (ByVal hwnd As Long, _
' ByVal lpOperation As String, _
' ByVal lpFile As String, _
' ByVal lpParameters As String, _
' ByVal lpDirectory As String, _
' ByVal nShowCmd As Long) As Long

'Private Const SW_SHOW As Integer = 1
Protected Sub btnPdf_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPdf.Click
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As [String] = Nothing
Dim encoding As [String] = Nothing
Dim extension As [String] = Nothing
Dim bytes As [Byte]() = Nothing
Dim Folder As String

bytes = ReportViewer1.LocalReport.Render("PDF", "", mimeType, encoding, extension, streamids, warnings)
Dim str As String = Session("POrderNO")
'Folder = ' & DateTime.Now.ToString("dd-MM-yyyy")
'If Folder = vbNullString Then
' lblPdf.Text = "Please set the Pdf path"
' Exit Sub
'End If




Folder = Server.MapPath("~\PDFDownload\PO")
Dim di As DirectoryInfo = New DirectoryInfo(Folder)
Dim path As String
Dim fs As FileStream
Dim data As Byte()
If di.Exists Then
If Not File.Exists(Folder & "\" & str & ".pdf") Then
path = Folder & "\" & str & ".pdf"
Session("MailId") = path
fs = New FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)
data = New Byte(fs.Length - 1) {}
fs.Write(bytes, 0, bytes.Length)
fs.Close()
End If
Else
di.Create()
If Not File.Exists(Folder & "\" & str & ".pdf") Then
path = Folder & "\" & str & ".pdf"
Session("MailId") = path
fs = New FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)
data = New Byte(fs.Length - 1) {}
fs.Write(bytes, 0, bytes.Length)
fs.Close()
di.Refresh()
End If
End If
'
'Session("MailId") = str & ".pdf"
'Dim paths As String = Server.MapPath("~/PDFD/Uploads/")
Dim fName As String = Server.MapPath("~\PDFDownload\PO\" & str & ".pdf")
Dim fi As New FileInfo(fName)
Dim sz As Long = fi.Length

Response.ClearContent()
Response.ContentType = "Application/pdf"
Response.AddHeader("Content-Disposition", String.Format("attachment; filename = {0}", System.IO.Path.GetFileName(fName)))
Response.AddHeader("Content-Length", sz.ToString("F0"))
Response.TransmitFile(Server.MapPath("~\PDFDownload\PO\" & str & ".pdf"))
Response.End()



End Sub
AnswerRe: Regarding PDF Converted file Pin
ZurdoDev2-Oct-14 5:42
professionalZurdoDev2-Oct-14 5:42 
QuestionJavascript logic causes the page to be stuck Pin
ThetaClear29-Sep-14 8:32
ThetaClear29-Sep-14 8:32 
AnswerRe: Javascript logic causes the page to be stuck Pin
Richard Deeming29-Sep-14 9:14
mveRichard Deeming29-Sep-14 9:14 
GeneralRe: Javascript logic causes the page to be stuck Pin
ThetaClear29-Sep-14 9:58
ThetaClear29-Sep-14 9:58 
GeneralRe: Javascript logic causes the page to be stuck Pin
ThetaClear4-Oct-14 5:16
ThetaClear4-Oct-14 5:16 
QuestionHow to verify email address using mx record? Pin
miss78629-Sep-14 0:37
miss78629-Sep-14 0:37 
AnswerRe: How to verify email address using mx record? Pin
Richard Deeming29-Sep-14 1:58
mveRichard Deeming29-Sep-14 1:58 
GeneralRe: How to verify email address using mx record? Pin
miss7863-Oct-14 0:36
miss7863-Oct-14 0:36 
GeneralRe: How to verify email address using mx record? Pin
Richard Deeming3-Oct-14 2:09
mveRichard Deeming3-Oct-14 2:09 
QuestionAsp.net Ajax Autocomplete Return value to Search another Pin
Member 122810828-Sep-14 22:45
Member 122810828-Sep-14 22:45 
AnswerRe: Asp.net Ajax Autocomplete Return value to Search another Pin
Sibeesh KV29-Sep-14 0:53
professionalSibeesh KV29-Sep-14 0:53 
Questionweb form using 2 gridview controls Pin
dcof26-Sep-14 4:49
dcof26-Sep-14 4:49 
QuestionReducing form size Pin
Member 876166726-Sep-14 2:31
Member 876166726-Sep-14 2:31 
AnswerRe: Reducing form size Pin
jkirkerx26-Sep-14 11:51
professionaljkirkerx26-Sep-14 11:51 
GeneralRe: Reducing form size Pin
Member 87616674-Oct-14 11:28
Member 87616674-Oct-14 11:28 
QuestionFrom active directory Lookup finding AD Attributes (ie Account Locked) Pin
Stephen Holdorf25-Sep-14 14:13
Stephen Holdorf25-Sep-14 14:13 
AnswerRe: From active directory Lookup finding AD Attributes (ie Account Locked) Pin
Stephen Holdorf25-Sep-14 14:29
Stephen Holdorf25-Sep-14 14:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.