|
Please read the forum guidelines. highlights include:
1. Don't include 'help' or 'urgent' in your message titles.
2. Name your message something meaninfull like 'question about uploading a video file.'
3. Do not use text speak. Please use plain English.
______________________
stuff + cats = awesome
|
|
|
|
|
Hi all,
In order to download file i have written this code
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment; FileName=" + dt.Tables ["Attachment"].Rows[0]["Attachment_Name"].ToString());
Response.BinaryWrite((Byte[])dt.Tables["Attachment"].Rows[0]["Attachment_File"]);
this code works well with SQL server but does nothing with MS Access. is there any alternative of this code is available or how can i make this code usefull for MS Access... Thanx to all
Regards, Qaiser Nadeem
|
|
|
|
|
Try with this code
Private Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.ContentType = "application\octet-stream"
Dim filename as string=new string("c:\\downloads\\hi.doc")
Dim downloadFile As System.IO.FileStream = New System.IO.FileStream(filename, IO.FileMode.Open)
Response.Write(downloadFile.Length() & "#")
downloadFile.Close()
Response.WriteFile(filename)
Response.Flush()
Response.End()
End Sub
Regards,
Satips.
|
|
|
|
|
its VB.NET, do u have c# code???
Regards, Qaiser Nadeem
|
|
|
|
|
|
Can anybody let me know the code i've given below is sufficient or not for sending E-Mail on the net
If yes then i would like to tell u that it is not working properly
It is just sending the message "Mail Sent Successfully" as i used for success message but i'm not receiving the mail at my id as i've defined "manoj.manojbisht@gmail.com"
But i'm still confused about "SMTP SERVER" i've kept it blank. Should i use something else if yes plz let me know....................................................................................................................................................
MailMessage mail=new MailMessage();
mail.To="manoj.manojbisht@gmail.com";
mail.From="msb1984_620@yahoo.com";
mail.Subject="Manoj Bisht";
mail.Priority=MailPriority.High;
mail.Body="Hello How R U";
try
{
SmtpMail.SmtpServer="";
SmtpMail.Send(mail);
//Response.Write("Mail Sent Successfully");
lblMsg.Text="Mail Sent Succesffully";
lblMsg.ForeColor=Color.DarkBlue;
}
catch(Exception ex)
{
Response.Write("Message Failed");
}
|
|
|
|
|
Pls check the Spam Folder.
Regards,
Satips.
|
|
|
|
|
SPAM folder is also empty
|
|
|
|
|
Apply Break Point and check it whether it is blocked by your ISP or the code.
Regards,
Satips.
|
|
|
|
|
try
{
string msgBody = "";
string configToAddresses = "";
string[] toAddressesArray;
configToAddresses = ConfigurationManager.AppSettings["MSG_REQUEST_TO_EMAIL_ADDRESS"].Trim();
MailMessage msg = new MailMessage();
msg.From = new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_FROM_EMAIL_ADDRESS"].Trim());
toAddressesArray = configToAddresses.Split(';');
// Add to Addresses in email
foreach (string toAddress in toAddressesArray)
{
msg.To.Add(new MailAddress(toAddress));
}
if (ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim().Length > 0)
{
msg.CC.Add(new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim()));
}
msg.Subject = ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_SUBJECT"].Trim() + " " + DateTime.Now;
msgBody = ConfigurationManager.AppSettings["MSG_REQUEST_SALUTE_EMAIL"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_START"].Trim() + " " + this.txtName.Text.Trim() + " (" + this.txtEmail.Text.Trim() + ")";
if (this.txtOrganization.Text.Trim().Length > 0)
{
msgBody += " of " + this.txtOrganization.Text.Trim();
}
msgBody += " on " + DateTime.Now + ". ";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_MIDDLE"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_URL"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL"].Trim() + "\r\n\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM"].Trim() + "\r\n";
msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM_URL"].Trim();
msg.Body = msgBody;
SmtpClient client = new SmtpClient();
client.Host = ConfigurationManager.AppSettings["SMTP_HOST"];
client.Port = int.Parse(ConfigurationManager.AppSettings["SMTP_PORT"]);
client.Send(msg);
}
catch (System.Threading.ThreadAbortException ex) { }
catch (Exception ex)
{
ConfigurationManager.AppSettings["DEFAULT_MESSAGE"] = ex.ToString();
Response.Redirect("Message.aspx");
}
Regards, Qaiser Nadeem
|
|
|
|
|
Sir the code u sent me is it running properly i mean.
Will i have to make any changes in web.config file
If yes plz let me know I'm waiting for response by ur side
|
|
|
|
|
yes, yes, its working properly, but you have to define the msgs in web.config
Regards, Qaiser Nadeem
|
|
|
|
|
should i send u the web msgs????
Regards, Qaiser Nadeem
|
|
|
|
|
yes plz send the web.config code too
|
|
|
|
|
<add key="MSG_REQUEST_EMAIL_SUBJECT" value="New MTAP Travel Request Added on">
<add key="MSG_REQUEST_SALUTE_EMAIL" value="Dear Administrator,">
<add key="MSG_REQUEST_EMAIL_BODY_START" value="A new travel request has been added on the MTAP Travel web site by">
<add key="MSG_REQUEST_EMAIL_BODY_MIDDLE" value="Please go to the following URL and log in to see the newly added travel request:">
<add key="MSG_REQUEST_FROM_EMAIL_ADDRESS" value="qnadeem@iengineering.com">
<add key="MSG_REQUEST_TO_EMAIL_ADDRESS" value="qnadeem@iengineering.com">
<add key="MSG_REQUEST_CC_EMAIL_ADDRESS" value="q.nadeem@hotmail.com">
<add key="MSG_REQUEST_SIGNATURE_EMAIL" value="Thank you,">
<add key="MSG_REQUEST_SIGNATURE_EMAIL_URL" value="URL: http://www.define your own web page.com">
<add key="MSG_REQUEST_SIGNATURE_EMAIL_TEAM" value="MTAP Travel Team">
<add key="MSG_REQUEST_SIGNATURE_EMAIL_TEAM_URL" value="http://dev.travel.mtap.org">
if u still have any questions then plz come on q.nadeem@hotmail.com
Regards, Qaiser Nadeem
|
|
|
|
|
How to get the SMTP server of the system
Thnx in advance
|
|
|
|
|
Open the IIS then check for Default SMTP server name if you are able to see Stop
button then it is running or if it is in stop mode then try to start it
Are you tring this at your home machine or you are in some organization
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I'm trying this in my Office and I'm using ASP.NET 1.1 with c#
|
|
|
|
|
Many organization stops the Default SMTP server and will not allow you to send any mail due to organizational policies
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
For configuring the SMTP server you have to follow the steps given below:
Go to>Start Menu>Control Panel>Administrator Tools>Internet Information Services.
Click the Internet Information Services and locate the Default SMTP Virtual Server.
If you have the rights to go try itin ur office .
If it is ur own PC means try as i said.
Regards,
Satips.
|
|
|
|
|
Continue in the Same thread.
BTW why are you creating the New thread.?
Regards,
Satips.
|
|
|
|
|
I am new in ASP can I got the problem in the login form with sql server databas
can any one told me How can i resolve this problem . My code is givin below.
<%
sql = "select * from login where u_id = '" & uname& "' AND pwd = '" &passwd& "'"
'response.Write(sql)
'response.End()
Set rst = Server.CreateObject("Adodb.Recordset")
rst.Open sql, conn, 3, 3
'username=rst("u_id")
'password=rst("pwd")
'response.Write(username)
'response.Write(password)
'response.End()
Its Work correctly from here. But when i write code below. I mense if condition it can not be work.
If rst.EOF and rst.BOF then
msg = "Wrong Entry ! please try again"
Response.redirect "index.asp"
Response.End()
Else
session("UserId")=Rs("uname")
msg =""
Response.redirect "AdminIndex.asp"
Response.end
End If
%>
Regard's
Kaushik
|
|
|
|
|
Y_Kaushik wrote: I got the problem in the login form with sql server databas
What error?
Regards,
Satips.
|
|
|
|
|
Before if statement code work correctly but
When i try to compare login info with database. its if statement is not redirect the page
If rst.EOF and rst.BOF then
msg = "Wrong Entry ! please try again"
Response.redirect "index.asp"
Response.End()
Else
session("UserId")=Rs("uname")
msg =""
Response.redirect "AdminIndex.asp"
Response.end
End If
I don't think above code is where wrong . The if statement is not work corectly.
Regard's
Kaushik
|
|
|
|
|
Put break point and check the code whether it is displaying the User name or not.
Regards,
Satips.
|
|
|
|