16,012,110 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 9884645 (Top 47 by date)
Member 9884645
18-Mar-13 11:58am
View
in app.config easy to specify absolute path but how to define relative path..? any idea?
Member 9884645
18-Mar-13 10:58am
View
Isn't it possible that i can specify path in app.config file?
Member 9884645
18-Mar-13 8:46am
View
yeah but i need not to change everywhere if i am doing some change..i need to go into one xml or app.config file and there i can change it and it will reflect everywhere ...
or will you suggest me few more changes i can do to make program more correct ..like few settings or configuration or something like that..
Member 9884645
18-Mar-13 8:34am
View
I want to ask you one more question ...the path which i am retrieving by using above code..Can i store it into app.config or any xml file and call it program code... if it is possible then can you please help how to write it????? so i can store all configuration at same place and later if i want to change then i can easily change.... I dont know is it viable or not...
Thanks...
Member 9884645
18-Mar-13 8:34am
View
I want to ask you one more question ...the path which i am retrieving by using above code..Can i store it into app.config or any xml file and call it program code... if it is possible then can you please help how to write it????? so i can store all configuration at same place and later if i want to change then i can easily change.... I dont know is it viable or not...
Thanks...
Member 9884645
15-Mar-13 9:35am
View
thanks a lot.. :)
Member 9884645
15-Mar-13 9:34am
View
thanks a lot once again
Member 9884645
15-Mar-13 8:03am
View
Thanks for your guidance regarding tracing by using event log and rest of stuffs... now it is working ok.. please post your answer as a solution so i can mark it....
thanks once again.... :)
Member 9884645
15-Mar-13 8:02am
View
Thanks for your guidance.. now it is working ok.. please post your answer as a solution so i can mark it....
thanks once again.... :)
Member 9884645
14-Mar-13 12:45pm
View
Thanks.. its is working ohk...
but still i want to ask you if image folder is not resided in same folder where .exe reside...then which syntax i should use?
Member 9884645
14-Mar-13 11:55am
View
How it is possible to place image folder in debug folder...i mean i am not putting data in image folder it is default created by some other application... Am i correct as you are talking to cut Image folder from where it is now and paste it into debug folder????
Member 9884645
14-Mar-13 11:50am
View
hi my cn.open is working ok.. i trace it by using eventlog. .. I guess i am doing mistake
in string ImgExist = Path.GetFullPath("~/Images/") + stamp + ".jpg"; syntax as it fins windows path..... In web application i was using server.mappath but in windows i guess problem is there.... so if we want to retrive file from specific folder which is in webservice how to retrive it....
i am bit confused how to write that syntax to get path of image folder which is in same where my .exe lies.. say Imageresizer is my service name then image folder lies in Imageresizer/Imageresizer/Image...where my exe is in Imageresizer/Imageresizer/bin/Debug/Imageresizer.exe
Member 9884645
14-Mar-13 11:44am
View
yes in the same path.. can you please write whole code for that syntax.. i am bit confused how to write that syntax to get path of image folder which is in same where my .exe lies.. say Imageresizer is my service name then image folder lies in Imageresizer/Imageresizer/Image...where my exe is in Imageresizer/Imageresizer/bin/Debug/Imageresizer.exe
Member 9884645
14-Mar-13 11:34am
View
Thanks your I trace code as you suggested... I found connection is okay but proble is with
string ImgExist = Path.GetFullPath("~/Images/") + stamp + ".jpg";
same as i discussed with you previously what to use in place of server.mappath..i tried gettfullpath syntax and i guess it might be not working as the way i want......
Member 9884645
14-Mar-13 11:32am
View
yeah i trace code by using eventlog.. connection is working fine but the problem is with.....
string ImgExist = Path.GetFullPath("~/Images/") + stamp + ".jpg";
in web application i used Server.mappath to retrive virtual directory image file. but in windows service i dont have any clue... so can you tell me if we want to retrive image file from specific folder then how can i do it...have you any idea?
Member 9884645
14-Mar-13 11:28am
View
hi my cn.open is working ok.. i trace it by using eventlog. .. I guess i am doing mistake
in string ImgExist = Path.GetFullPath("~/Images/") + stamp + ".jpg"; syntax as it fins windows path..... In web application i was using server.mappath but in windows i guess problem is there.... so if we want to retrive file from specific folder which is in webservice how to retrive it....
Member 9884645
14-Mar-13 10:45am
View
need to add logging mean? i am not getting. I am very new to windows service so can you please explain it further. As i have no clue where i am wrong...
Member 9884645
14-Mar-13 10:44am
View
I narrow down the above code.. I tried that by putting server name but it is also same . I am not getting where i am wrong...
Member 9884645
14-Mar-13 10:31am
View
In that case is it required to change connection string ? or it is fine for my program also.
Member 9884645
14-Mar-13 10:23am
View
But the same connection string is working absolutely okay in web application then why not in windows service. still if you suggesting then i will try it by doing change. I am using MS SQL server
Member 9884645
14-Mar-13 10:18am
View
I gave database name as well as username and password also..
No i didnt go for sql trace. As same code is working okay in web application so there shoould be problem in calling the connection or initialization in program it self and thats why i posted whole coding here....
Member 9884645
14-Mar-13 10:15am
View
i have posted connection string in first part of code from app.config file
Member 9884645
13-Mar-13 11:41am
View
i tried using thread also but it gives same error. yeah if i am remiving code then i can start service.....
Member 9884645
13-Mar-13 11:35am
View
oh i am really sorry i post it as a answer link...but do you have any idea about my issue?
Member 9884645
13-Mar-13 11:31am
View
but still it is not working.. i need help
Member 9884645
13-Mar-13 11:07am
View
I am still not getting your point.I am very new to windows service. I want same functionality in my windows service as it is in my asp.net web application.
It haven't any UI.
I am briefing my web application here so according to that you can guide me how to do it in windows service.
Retrieving very Big image from IMAGE folder which resides in my web application according to certain condition.
Resize those image and store it into database.
Retrive resized images stored in database and store it into server folder called Large and again resize that image in 3 more different size and save into their three respective size folders called List, Mini,*Thumb* on server.
Now i want to build windows service with same functionality and it run on server after every 15 mins.
Hope now i am more clear. please help me in this regards.
my web application code is working fin. but i don't know where to put this code in my windows service as I am very new to windows service.
I tried to put that code onstart and also oncontinue method but that time service not allowed to start. It gives error message this service can not start on your local machine.
Member 9884645
13-Mar-13 6:51am
View
What does it mean? I am not getting you point.
Member 9884645
12-Mar-13 12:11pm
View
W:\nilam\Proj1\WindowsService1\WindowsService1\Images
As of now it is in my windows service project folder.. sorry if i am doing really foolish thing because i have no clue for windows services.
Member 9884645
12-Mar-13 11:58am
View
i stuck in very beginning at IMAGE folder,how to get path of it and retrive image from it. i was using all the time only server.mappath to retrive the file and store the file
if i solved it then may be will solve all issue hopefully...
Member 9884645
12-Mar-13 11:48am
View
My proj is
1.Get Big image from folder called IMGAE according to certain condition
2. Resize those images store it into database
3. Retrive that resized image and store it on server disk folder called LARGE
4. Again resize image from LARGE in 3 different size and store it in respective 3 different folder.
5. This process continue
I did all this in Web application in asp.net but in windows service point of view i am not getting how to get images from file which i was getting in web app through server.mappath
Member 9884645
12-Mar-13 11:35am
View
then how will i set my folder from which i need to extract files...
i need image file which resides in image folder in windowsservices.
Member 9884645
12-Mar-13 11:29am
View
string ImgExist =Assembly.GetExecutingAssembly("~/Images/").CodeBase + stamp + ".jpg";
string ImgExist =Assembly.GetExecutingAssembly("~/Images/").Location + stamp + ".jpg";
I tried both option but it says no overload getexecutionassembly takes only 1 argument.
Member 9884645
12-Mar-13 11:20am
View
no it is not working... :(
Member 9884645
12-Mar-13 11:04am
View
yes but there is one block only for connection string not so many setting like in web.config
Member 9884645
12-Mar-13 11:02am
View
oh thanks, I got it, it is System.Configuration only not configuration manager so i was bit confused.
one more question to retrive file from directory which resided in webapplication i was using server.mappath but for windows service its not supported. then how will i retrive. also in webconfig i have set max length for image(size to load)and execution timeout but in app.config can i set it same way???
thanks a lot for your help...
Member 9884645
12-Mar-13 10:54am
View
I created app.config file but it has just following coding so how i can use other setting which i did in web.config file in webapplication.
<configuration>
connection string i have added::::::
<add name="b1" .......="" providername="System.Data.SqlClient">
Member 9884645
12-Mar-13 10:50am
View
i mean if i am adding reference then it required source dll file . so form where i can get it??? should i download form internet or what not getting.
Member 9884645
12-Mar-13 10:49am
View
Deleted
I created app.config file but it has just following coding so how i can use other setting which i did in web.config file in webapplication
<configuration>
Member 9884645
12-Mar-13 10:46am
View
no i am not able to find app.config file in my windows service ,
how to add reference System.ConfigurationManager 3.0 version.. I mean source or smthing like
Member 9884645
12-Mar-13 10:18am
View
i have also read the same. but how to get app.config file. I know to create web.config but not about app.config.
also there is System.configuration is available in web service. but it is not supporting configurationmanager.
Member 9884645
12-Mar-13 10:02am
View
Hi Thanks,
Connection string which i stored in web application web.config file.Working fine in web application but not working i windows service as it is not supporting System.Web.Configuration. Below is code to call in to windows service:
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["b1"].ConnectionString);
not working also server.mappath() is also not working. so what to write their place?
Member 9884645
12-Mar-13 10:02am
View
Deleted
Connection string which i stroed in webapplication web.config file.Working fine in webapplication but not working i windows service as it is not supporting System.Web.Configuration. Below is code to call in to windows service:
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["b1"].ConnectionString);
not working also server.mappath() is also not working. so what to write their place?
Member 9884645
6-Mar-13 12:14pm
View
I am retrieving image from Image(Image folder in my Webapplication1) which lies on my disk according to certain condition.
After that I am resizing those image on page_load event of source_page.aspx(Lies in Webapplication1) and storing resized image in Resized(Folder in my webapplication1)folder. At that time it store image in .jpg format not in bytecode.
Also same time I am making resized image in byte code ( as i am not sure which i can easily pass to targetpage_aspx.)
I want to post that image on target.aspx(lies in webapplication2)page. where it will further resize image in three different size and store in local disk or first_receive(Image folder in webapplication2).
I am not worried about further resizing that i will do. Here i am assuming that resized image i want to store in folder(in webapplication2).
So question is how to pass that resize image from Sourcepage.aspx(Webapplication1) and how to receive it on Targetpage.aspx(Webapplication2)?
Hope now i am bit more clear in my question..
Member 9884645
6-Mar-13 11:51am
View
I have gone through your sample. I have resized image and store it in byte code.
Now I am not getting what to do next?
and also in which webpage sourcepage.aspx(in webapplication1) or targetpage.aspx(in webapplication2) i need to add code for bitmap and drawing bitmap. I am not experienced in asp.net. so i need bit more clarity...
I need to know how for both pages
Thanks for your help but it would be great if you explore it more as a novice one.
Member 9884645
6-Mar-13 11:32am
View
Sorry I missed few lines, but still have same prob. It create just boundry not load image and it is also on same page..
ASCIIEncoding encoding = new ASCIIEncoding();
string postImg = folder + Fname;
byte[] data = encoding.GetBytes(postImg);
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:51399/TestReceive.aspx");
myRequest.Method = "POST";
//myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentType = "multipart/form-data";
myRequest.KeepAlive = true;
myRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
HttpWebResponse response = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string tmp = reader.ReadToEnd();
response.Close();
Response.Write(tmp);
Member 9884645
6-Mar-13 7:44am
View
I write code to post Image on source page as below...I am not sure about it.. If it is correct code then how to receive image on target page ???? Here folder contains the path of the file in which it lies and Fname is name of the image file.
ASCIIEncoding encoding = new ASCIIEncoding();
string postImg = folder + Fname;
byte[] data = encoding.GetBytes(postImg);
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:51399/TestReceive.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
Member 9884645
6-Mar-13 7:41am
View
Thanks for your reply..
I have resized the image but i dont know how to post it now.. and how i will receive it on target page.... so could you provide coding for both pages.... post page and receiving page as well...
Please help me..
Show More