473,287 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

resume

hi,

i am uploading .doc,.docX,rtf files during registration level and that path can be saved in database(i am using database MYSQL).when user want to see his resume he/she can login and retrive his details by clicking on retrive button.my problem is the code will be working in local system it not working in server.i am attaching my code shown below
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using Microsoft.Office.Interop;
  12. using System.IO;
  13. using System.Reflection;
  14.  
  15. #endregion
  16.  
  17. public partial class ResUploadOrCompDesc : System.Web.UI.Page
  18. {
  19.     #region "Global Variables                   "
  20.  
  21.     DataAccess ObjDA;
  22.  
  23.     #endregion
  24.  
  25.     #region "Page_Load                          "
  26.  
  27.     protected void Page_Load(object sender, EventArgs e)
  28.     {
  29.         try
  30.         {
  31.             string UName = "";
  32.             string TblType = "";
  33.             ObjDA = new DataAccess();            
  34.             lblErrMsg.Text = "";
  35.  
  36.             if (!IsPostBack)
  37.             {
  38.                 Session["MyAccount"] = "false";
  39.                 if (Session["UserName"] == null)
  40.                     Response.Redirect("Home.aspx");
  41.                 else
  42.                 {
  43.                     UName = Session["UserName"].ToString();
  44.  
  45.                     if (Session["TblType"] != null)
  46.                         TblType = Session["TblType"].ToString();
  47.  
  48.                     Session["MyPhoto"] = "~/UserPhotos/" + UName + @"\" + ObjDA.GetScalarValues(TblType + "MyAcc", "", "username='" + UName + "'");
  49.  
  50.                     if (TblType == "PRD4")
  51.                     {
  52.                         imgbtnGetResInfo.Visible = false;
  53.                         fudResume.Visible = false;
  54.                         lblUpload.Visible = false;
  55.                         lblValMsg.Visible = false;
  56.                         txtResume.Text = ObjDA.GetScalarValues(TblType, "compdesc", "username='" + UName + "'");
  57.                     }
  58.                     else
  59.                     {
  60.                         imgbtnGetResInfo.Visible = true;
  61.                         fudResume.Visible = true;
  62.                         lblUpload.Visible = true;
  63.                         lblValMsg.Visible = true;
  64.                     }
  65.                     //if (IsPostBack)
  66.                     //{
  67.                     //    if (Request.Form["hid_f"] == "1")   //if user clicks "OK" to confirm 
  68.                     //    {
  69.                     //        int i = 0;
  70.                     //        Request.Form["hid_f"].Replace("1", "0");
  71.                     //        i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "", UName, "D");
  72.                     //        ObjDA.InsertOrUpdateOrDeleteData("Ref", "", Session["a"].ToString(), "D");
  73.                     //        if (i == 1)
  74.                     //        {
  75.                     //            MsgBox1.alert("Account deleted sucessfully");
  76.                     //            Response.Redirect("home.aspx");
  77.                     //        }
  78.                     //        else
  79.                     //        {
  80.                     //            MsgBox1.alert("Unable to delete the selected record and try again");
  81.                     //        }
  82.                     //    }
  83.                     //}
  84.                 }
  85.             }
  86.         }
  87.         catch (Exception ex)
  88.         {
  89.             lblErrMsg.Text = ex.Message;
  90.         }
  91.         finally
  92.         {
  93.             if (ObjDA != null)
  94.                 ObjDA = null;
  95.         }
  96.     }
  97.  
  98.     #endregion
  99.  
  100.     #region "imgbtnGetResInfo_Click             "
  101.  
  102.     protected void imgbtnGetResInfo_Click(object sender, ImageClickEventArgs e)
  103.     {
  104.         try
  105.         {
  106.             string UName = "";
  107.             string TblType = "";
  108.             string ResumeFilePath = "";
  109.             ObjDA = new DataAccess();
  110.  
  111.             if (Session["UserName"] != null)
  112.                 UName = Session["UserName"].ToString();
  113.             if (Session["TblType"] != null)
  114.                 TblType = Session["TblType"].ToString();
  115.  
  116.             //Request.Form["hid_f"].Replace("1", "0");
  117.  
  118.             ResumeFilePath = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName + "\\" + ObjDA.GetScalarValues(TblType, "resume", "UserName='" + UName + "'");
  119.  
  120.             if (File.Exists(ResumeFilePath))
  121.             {
  122.                 Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
  123.                 object FileName = ResumeFilePath;
  124.                 object nullobj = System.Reflection.Missing.Value;
  125.                 Microsoft.Office.Interop.Word.Document DocOne = wordApp.Documents.Open(ref FileName, ref nullobj, ref nullobj,
  126.                                                                                     ref nullobj, ref nullobj, ref nullobj,
  127.                                                                                     ref nullobj, ref nullobj, ref nullobj,
  128.                                                                                     ref nullobj, ref nullobj, ref nullobj,
  129.                                                                                     ref nullobj, ref nullobj, ref nullobj, ref nullobj);
  130.  
  131.                 Microsoft.Office.Interop.Word.Document DocTwo = wordApp.ActiveDocument;
  132.                 txtResume.Text = DocTwo.Content.Text;
  133.                 DocOne.Close(ref nullobj, ref nullobj, ref nullobj);
  134.             }
  135.             else
  136.             {
  137.                 lblErrMsg.Text = "No File Uploaded";
  138.             }
  139.         }
  140.         catch (Exception ex)
  141.         {
  142.             lblErrMsg.Text = ex.Message;
  143.         }
  144.         finally
  145.         {
  146.             if (ObjDA != null)
  147.                 ObjDA = null;
  148.         }
  149.     }
  150.  
  151.     #endregion
  152.  
  153.     #region "imgbtnUpdateResume_Click           "
  154.  
  155.     protected void imgbtnUpdateResume_Click(object sender, ImageClickEventArgs e)
  156.     {
  157.         try
  158.         {
  159.             int FilesCount = 0;
  160.             string UName = "";
  161.             string TblType = "";
  162.             string DirName = "";
  163.             int i = 0;
  164.             ObjDA = new DataAccess();
  165.  
  166.             if (Session["UserName"] != null)
  167.                 UName = Session["UserName"].ToString();
  168.             if (Session["TblType"] != null)
  169.                 TblType = Session["TblType"].ToString();
  170.  
  171.             DirName = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName;
  172.  
  173.             if (imgbtnGetResInfo.Visible == true)
  174.             {
  175.                 if (Directory.Exists(DirName) == false)
  176.                     Directory.CreateDirectory(DirName);
  177.                 else
  178.                 {
  179.                     FilesCount = Directory.GetFiles(DirName).Length;
  180.                     if (FilesCount > 0)
  181.                     {
  182.                         for (int j = 0; j < FilesCount; j++)
  183.                         {
  184.                             if (File.Exists(Directory.GetFiles(DirName)[j].ToString()))
  185.                                 File.Delete(Directory.GetFiles(DirName)[j].ToString());
  186.                         }
  187.                     }
  188.                 }
  189.  
  190.                 fudResume.SaveAs(DirName + @"\" + fudResume.FileName.ToString());
  191.  
  192.                 ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume=''", "UserName='" + UName + "'", "U");
  193.                 i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume='" + fudResume.FileName.ToString() + "'", "UserName='" + UName + "'", "U");
  194.  
  195.                 if (i == 1)
  196.                 {
  197.                     lblErrMsg.Text = "Resume uploaded successfully";
  198.                     txtResume.Text = "";
  199.                 }
  200.             }
  201.             else
  202.             {
  203.                 ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc=''", "UserName='" + UName + "'", "U");
  204.                 i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc='" + txtResume.Text + "'", "UserName='" + UName + "'", "U");
  205.                 if (i == 1)
  206.                     lblErrMsg.Text = "Company Description updated successfully";
  207.             }
  208.  
  209.         }
  210.         catch (Exception ex)
  211.         {
  212.             lblErrMsg.Text = ex.Message;
  213.         }
  214.         finally
  215.         {
  216.         }
  217.     }
  218.  
  219.     #endregion
  220.  
(***here is no server problem*****)can any one help me plzzzz
Feb 19 '09 #1
3 2899
hi,

i am uploading resume in registration levels.the user want to see his/her resume he/she can login and click on 'getresume' button all the information could be displayed in multiline text box.my problem is it will be working on local system when we are hosting the resume will not be displayed. i am using my sql database.my code will be shown below

Expand|Select|Wrap|Line Numbers
  1. #region "imgbtnGetResInfo_Click             "
  2.  
  3.     protected void imgbtnGetResInfo_Click(object sender, ImageClickEventArgs e)
  4.     {
  5.         try
  6.         {
  7.             string UName = "";
  8.             string TblType = "";
  9.             string ResumeFilePath = "";
  10.             ObjDA = new DataAccess();
  11.  
  12.             if (Session["UserName"] != null)
  13.                 UName = Session["UserName"].ToString();
  14.             if (Session["TblType"] != null)
  15.                 TblType = Session["TblType"].ToString();
  16.  
  17.             //Request.Form["hid_f"].Replace("1", "0");
  18.  
  19.             ResumeFilePath = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName + "\\" + ObjDA.GetScalarValues(TblType, "resume", "UserName='" + UName + "'");
  20.  
  21.             if (File.Exists(ResumeFilePath))
  22.             {
  23.                 Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
  24.                 object FileName = ResumeFilePath;
  25.                 object nullobj = System.Reflection.Missing.Value;
  26.                 Microsoft.Office.Interop.Word.Document DocOne = wordApp.Documents.Open(ref FileName, ref nullobj, ref nullobj,
  27.                                                                                     ref nullobj, ref nullobj, ref nullobj,
  28.                                                                                     ref nullobj, ref nullobj, ref nullobj,
  29.                                                                                     ref nullobj, ref nullobj, ref nullobj,
  30.                                                                                     ref nullobj, ref nullobj, ref nullobj, ref nullobj);
  31.  
  32.                 Microsoft.Office.Interop.Word.Document DocTwo = wordApp.ActiveDocument;
  33.                 txtResume.Text = DocTwo.Content.Text;
  34.                 DocOne.Close(ref nullobj, ref nullobj, ref nullobj);
  35.             }
  36.             else
  37.             {
  38.                 lblErrMsg.Text = "No File Uploaded";
  39.             }
  40.         }
  41.         catch (Exception ex)
  42.         {
  43.             lblErrMsg.Text = ex.Message;
  44.         }
  45.         finally
  46.         {
  47.             if (ObjDA != null)
  48.                 ObjDA = null;
  49.         }
  50.     }
  51.  
  52.     #endregion
  53.  
  54.     #region "imgbtnUpdateResume_Click           "
  55.  
  56.     protected void imgbtnUpdateResume_Click(object sender, ImageClickEventArgs e)
  57.     {
  58.         try
  59.         {
  60.             int FilesCount = 0;
  61.             string UName = "";
  62.             string TblType = "";
  63.             string DirName = "";
  64.             int i = 0;
  65.             ObjDA = new DataAccess();
  66.  
  67.             if (Session["UserName"] != null)
  68.                 UName = Session["UserName"].ToString();
  69.             if (Session["TblType"] != null)
  70.                 TblType = Session["TblType"].ToString();
  71.  
  72.             DirName = AppDomain.CurrentDomain.BaseDirectory + @"UserResumes\" + UName;
  73.  
  74.             if (imgbtnGetResInfo.Visible == true)
  75.             {
  76.                 if (Directory.Exists(DirName) == false)
  77.                     Directory.CreateDirectory(DirName);
  78.                 else
  79.                 {
  80.                     FilesCount = Directory.GetFiles(DirName).Length;
  81.                     if (FilesCount > 0)
  82.                     {
  83.                         for (int j = 0; j < FilesCount; j++)
  84.                         {
  85.                             if (File.Exists(Directory.GetFiles(DirName)[j].ToString()))
  86.                                 File.Delete(Directory.GetFiles(DirName)[j].ToString());
  87.                         }
  88.                     }
  89.                 }
  90.  
  91.                 fudResume.SaveAs(DirName + @"\" + fudResume.FileName.ToString());
  92.  
  93.                 ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume=''", "UserName='" + UName + "'", "U");
  94.                 i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "resume='" + fudResume.FileName.ToString() + "'", "UserName='" + UName + "'", "U");
  95.  
  96.                 if (i == 1)
  97.                 {
  98.                     lblErrMsg.Text = "Resume uploaded successfully";
  99.                     txtResume.Text = "";
  100.                 }
  101.             }
  102.             else
  103.             {
  104.                 ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc=''", "UserName='" + UName + "'", "U");
  105.                 i = ObjDA.InsertOrUpdateOrDeleteData(TblType, "compdesc='" + txtResume.Text + "'", "UserName='" + UName + "'", "U");
  106.                 if (i == 1)
  107.                     lblErrMsg.Text = "Company Description updated successfully";
  108.             }
  109.  
  110.         }
  111.         catch (Exception ex)
  112.         {
  113.             lblErrMsg.Text = ex.Message;
  114.         }
  115.         finally
  116.         {
  117.         }
  118.     }
  119.  
(****there is no server problem its working fine***)

can any one help me plz
Feb 21 '09 #2
Hi,
If the application is working in localhost but not on webserver there can be these possibilites in my opinion:
1. You have not given access to read/write to the UserResumes directory. So the application is failing for writing the given resume.
2. Your Office components are not properly installed on the server.

Try to eliminate the above two. As far as I know, if server is working fine, client should not have any problem.
Feb 21 '09 #3
Frinavale
9,735 Expert Mod 8TB
What do you mean when you say your code is "not working" on the web server?
Is your website working but you are not able to upload files?
What is the error you are getting when you attempt to run the site on the web server?

If you have access to the web server, check the Windows Event Logs for any error messages generated by ASP.NET and please post them so that we have an idea of what's going on.

Do you have ASP.NET installed on the web server?

Is your web server configured to run your site with the same .NET Framework that your application was developed with?

Do you have all permissions set correctly?
Feb 24 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: jason | last post by:
Is there a way to avoid On Error Resume Next for: cnn.Open strCon SQL = "EXEC Customer @txtEmail='" & email_address & "'" set rs = cnn.execute(SQL) 'On error resume next rs("email_address")...
2
by: Ian DeRock | last post by:
I'm fairly new to XML. As I can see it, XML is a way to organize data like in a table in a RDB, or the RDB itself. I have used XML in application data, but did not design the actual XML. I...
2
by: Darta | last post by:
OK- I volunteer to be shot if this question is stupid... BUT, is there a way to, when you catch an exception in the catch{} handler, resume to the same line of code that generated an error while...
2
by: juky | last post by:
Hi all, I have a loop in the thread checking for a particular service status, whenever the status changes to "stopped" a RaiseEvent is generated by thread and another function runs. At the same...
3
by: bob.needler | last post by:
I know On Error Resume Next is generally considered lazy. But can someone tell me why the resume next in Exit_Handler does not seem to work? It generates the typical unhandled runtime error...
7
by: fniles | last post by:
In VB 6.0 in the error trapping, we can do "resume next" to continue on the next code. How can we do that in .NET with "Try", "Catch","End Try" ? Thanks
4
by: Neo | last post by:
I found on error resume next doesn't work in for each... e.g. on error resume next for each x in y 'do stuff next if you have an error in for each loop, it falls in infinite loop... it...
11
by: Maxwell2006 | last post by:
Hi, I know that this is not a good practice, but I wonder do we have "on error resume next" in C#? Thanks,
0
MMcCarthy
by: MMcCarthy | last post by:
Organizing a Resume Pertinent information included on your resume may be organized in a variety of ways. Regardless of the type of resume used, you should include the following: Contact...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.