|
Hi all,
i m sending mails using Asp.net 2.0
Here is my code
Sub SendMail()
Dim msg As New MailMessage()
Dim attach_file1 As String = String.Empty
Dim strfilename As String = String.Empty
Dim strpath As String = Request.ApplicationPath & "/" & "Attachments" & "/"
strfilename = Path.GetFileName(UploadCV.PostedFile.FileName)
UploadCV.PostedFile.SaveAs(Server.MapPath(strpath & strfilename))
Dim attach As New Attachment(Server.MapPath(strpath & strfilename))
msg.Attachments.Add(attach)
attach_file1 = strfilename
Dim smtpclnt As New SmtpClient()
Dim ds1 As New DataSet()
ds1 = CType(Session("Dataset"), DataSet)
msg.Subject = "You have successfully applied for the post of " & ds1.Tables(0).Rows(0).Item(2).ToString()
msg.Body = "Hi all"
'msg.To.Add(ds1.Tables(0).Rows(0).Item(9))
msg.To.Add("somemail@gmail.com")
msg.From = New MailAddress(Session("emailid").ToString())
smtpclnt.Send(msg)
If attach_file1 <> "" Then
File.Delete(Server.MapPath(strpath & strfilename))
End If
End Sub
but it gives me exception at
File.Delete(Server.MapPath(strpath & strfilename))
and it says
The process cannot access the file (filepath) because it is being used by another process.
any idea abt this error?
modified on Sunday, July 17, 2011 2:38 PM
|
|
|
|
|
Dear,
I want some idea from your mind.
Now assign a some value to current form as mystring variable.
I want mystring values, any where in the form.
the Request.QueryString() is get from previous form.
But I need the value any where in the project and any form without using
Response.Redirect() and Request.QueryString()
How to access the above matter.
Please tell me a your valuable advice. Above matter is working possible are not.
Kind regards
Thanking you,
abglorie
|
|
|
|
|
Hi,
You can use ViewState for this. or u also can use Cookie.
Happy Coding,
AS@13
A key to every Solution
|
|
|
|
|
Please give me a example code
Thanking you
|
|
|
|
|
Create a property and put it in session.
|
|
|
|
|
|
Session("mystring")=some value
It can be used any where in the application. Try this
|
|
|
|
|
Please read the forum guidelines. You have started several threads in which the message title has absolutely no meaning. Also, asking for the code is considered rude. You are expected to at least try programming and if you get stuck we will help.
|
|
|
|
|
hii
i have change my url name according to my requirment using global file concept
this is my function
void Application_BeginRequest(Object sender, EventArgs e)
{
String strCurrentPath;
String strCustomPath;
String StrReferrer;
if (Request.UrlReferrer != null)
StrReferrer = Request.UrlReferrer.PathAndQuery.ToString();
else
StrReferrer = "";
// for SubCategory
strCurrentPath = Request.Path;
strCurrentPath = strCurrentPath.ToLower().Replace("/RedTag/Client/".ToLower(), "");
if (strCurrentPath.StartsWith("subcategory.aspx"))
{
strCurrentPath = StrReferrer;
strCurrentPath = strCurrentPath.ToLower().Replace("/RedTag/Client/".ToLower(), "");
}
if (strCurrentPath.StartsWith("c-"))
{
string id = strCurrentPath.Split('-')[1].ToString();
strCustomPath = "category.aspx?catid=" + id.ToString();
Context.RewritePath(strCustomPath);
}
if (strCurrentPath.StartsWith("m-"))
{
string id = strCurrentPath.Split('-')[1].ToString();
strCustomPath = "subcategory.aspx?MFRID=" + id.ToString();
Context.RewritePath(strCustomPath);
}
if (strCurrentPath.StartsWith("s-"))
{
string id = strCurrentPath.Split('-')[1].ToString();
strCustomPath = "SubCategory.aspx?catid=" + id.ToString();
HttpContext.Current.RewritePath(strCustomPath);
// Context.RewritePath(strCustomPath);
}
if (strCurrentPath.StartsWith("p-"))
{
string id = strCurrentPath.Split('-')[1].ToString();
strCustomPath = "ItemPage.aspx?ProductID=" + id.ToString();
Context.RewritePath(strCustomPath);
}
}
now problem is that first time when my subcategory page load that time the url is like Client/s-1001-Data.aspx but when i do paging then my page is ispostback and my url change to SubCategory.aspx?catid=1001 means which is in
my Context.RewritePath ..i want the same url name should maintain through out the page...
Jintal Patel
|
|
|
|
|
hello sir
in my project i have one button view in excel.
In my project I have farpont spreadsheet when i click on view in excel button that time whatever we saw on farpoint spreadsheet that all save/view in excel spreadsheet.
guide me.
gayatri
Gayatri
|
|
|
|
|
Hi Gayatri,
Plz explain your query in details along with your code..and your problem.
Happy Coding,
AS@13
A key to every Solution
|
|
|
|
|
hello
my project is related to shares.
so i used farpoint spreasheet control in asp.net 2.0
which is look like excel spreadsheet.
when i click on button that time all data (which is available on screen)
will save in excel spreadsheet.
Gayatri
|
|
|
|
|
What is the datasource for ur spreadsheet control???
U can create an excel with ur datasource directly.....
|
|
|
|
|
hello
i am using sql datasource.
gayatri
Gayatri
|
|
|
|
|
hi
i am using asp.net 2.0
my project is shares related.
and i am using ado.net and sql database.
then how to export my application to excel.
Gayatri
|
|
|
|
|
u can use com object and prepare excel directly from database. Get data from database in a dataset, create and excelapp, workbook,worksheet etc and then just loop through the dataset assign the values to each cell.
|
|
|
|
|
|
hello
i write code but when i clicked on button that time one dialogbox coming which ask
"do you want to open or save file?"
file name - frmAnalystass.xls
when i click open
that time one message coming "you can't read it"
OR
when click save button that time file is saved.
when i open that saved file that time excel open but one message comming "you can't read it".
so please help me.
my code-====
protected void btnSaveToExcel_Click(object sender, EventArgs e)
{
objVarInit.sqlDS.Reset();
objVarInit.sqlDT.Reset();
objClsDllSql.sqlCon = objReadIniFile.funReadIniSql();
objClsDllSql.sqlCon.Open();
objVarInit.sqlDA = new SqlDataAdapter("select * from tUser", objClsDllSql.sqlCon);
objVarInit.sqlDT = new DataTable();
objVarInit.sqlDA.Fill(objVarInit.sqlDT);
objClsDllSql.sqlCon.Close();
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
string sep = "";
foreach (DataColumn dc in objVarInit.sqlDT.Columns)
{
Response.Write(sep + dc.ColumnName);
sep = "\t";
}
Response.Write("\n");
int i;
foreach (DataRow dr in objVarInit.sqlDT.Rows)
{
sep = "";
for (i = 0; i < objVarInit.sqlDT.Columns.Count; i++)
{
Response.Write(sep + dr[i].ToString());
sep = "\t";
}
Response.Write("\n");
}
}
gayatri
Gayatri
|
|
|
|
|
I am developing web sites using Visual Studio 2005 and typed dataset to access the database (SQL 2005 and Access 2003). Because the typed dataset generate parameterized queries, is that enough to be safe from SQL injection ?
|
|
|
|
|
ccess database i create a query but it give syntax error
|
|
|
|
|
Rewrite the query with proper syntax.....
It was a query or information for forum ....
|
|
|
|
|
Hi Folks,
I would like to more about the Satellite assembly.
Can anyone tell me more about satellite assembly?
How we can say an assembly as satellite assembly?
I'm using resource file,then can i say it as satellite assembly?
Thanks and Regards
Ganesan.S
|
|
|
|
|
Have you tried checking the same on google. There you will so much information.
Apurva Kaushal
|
|
|
|
|
Googling Google[^]
- Regards - JON Life is not measured by the amount of breaths we take, but by the moments that take our breath away.
|
|
|
|
|
Hai all,
i had one gridview filled with records from the database.
after that i want to insert or update records into the gridview.
if i click on addnew button,then it will send to another page,
there i have four textbox's of four colmns,and one button....
in this page if i click on the button,after entering into the four textbox's
then the records should be saved into the gridview of first page.
thanks in advance
Thanks
Subbu.
|
|
|
|