|
For a specific url which is opened in IE, I want the details temporay internet files (like images, textfiles, pdfs) of that specific URL. I try to retrieve all those information through wininet functions like FindfirstURLcacheEntry, FindNextURCacheEntry, GetUrlcacheEntryInfo,
I tried to make a log about all the details which can be obtained from temporary internet files for that specific url, I observed that I was unable to get the PDF path which exists in temparary internt files.
How can I get this,
Is there any other method to get that PDF?
If anyone knows something, plz suggest some solution. thank you
|
|
|
|
|
I would use HttpRequest class to request the same page again, then analyze the HTML code and again use HttpRequest to fetch the referenced files of interest.
|
|
|
|
|
Hi,
I am new to C#, I have a doubt please tell me the answer.
I have a form1. In that I am retrieving student information(studentgroup, studentname, admintionnumber). Now
<br />
<br />
namespace student_information<br />
{<br />
public partial class Form1 : Form <br />
{<br />
<br />
string m_stname;<br />
string m_sgroup;<br />
int m_iadminnum; <br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
m_stname = this.textBox1.Text;<br />
m_iadminnum = int.Parse(this.textBox2.Text);<br />
m_sgroup = this.comboBox1.SelectedItem.ToString();<br />
<br />
<br />
Form1 f1 = new Form1();<br />
<br />
f1.m_iadminnum = m_iadminnum;<br />
f1.m_sgroup = m_sgroup;<br />
f1.m_stname = m_stname;<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
}<br />
In the above code what i did is i am receiving information from form1,
Now that information in f1(object). Can any one tell what is the procedure for store this data into a file.
Also please tell me the procedure for retrieving object information from the same file.
Thanx in advance......
sampath-padamatinti
|
|
|
|
|
You can serialize the data using XMLSerializer class and write that to the file. You can deserialize the same to read it back into the object.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
m_stname = this.textBox1.Text;
m_iadminnum = int.Parse(this.textBox2.Text);
m_sgroup = this.comboBox1.SelectedItem.ToString();
Form1 f1 = new Form1();
f1.m_iadminnum = m_iadminnum;
f1.m_sgroup = m_sgroup;
f1.m_stname = m_stname;
}
While what you have will work, it is not exactly a good idea. When you create the new instance of Form1
Form1 f1 = new Form1();
you do not just allocate space for m_stname, m_iadminnum, and m_sgroup, you are also creating new instances of textBox1, textBox2, and comboBox1 as well as a whole load of other stuff you can't see - which is not exactly efficient or usefull.
Consider creating a separate class "StudentInfo" to hold your records, which has the name, admin number, and group. You can then give that class a constructor which takes the three parameters, and a Save/Load method which keeps the data neatly encapsulated.
Additional style points:
1) m_stname, m_iadminnum, and m_sgroup are no longer recommended for C# - consider studentName, adminNumber and studentGroup instead.
2) Don't call you controls by the default name: textBox1 is not as usefull as tbStudentName, button1 is less helpfull than butSave and so on. This may not make a big difference now, but when your app gets more complex (and it will) it makes life a whole lot easier.
3) In your button1_Click event, you do not need to prefix your control names with "this." - it is implied. The only time you should have to use "this" is when you have a parameter with the same name as a field.
4) Unless there is a very good reason for it, make your fields private - you can always add a public property if you need to expose them outside your class.
Trust me, it is worth getting these things right from the start - it is a whole lot easier than breaking bad habits later!
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Thanx for valuable suggestion.
sampath-padamatinti
|
|
|
|
|
There is lot of example for messenger or chat application. I did not find any example which will work when computer is behind router. There are many suggession about port forwarding or router configuration but this is not the case when I use Yahoo, MSN, AOL messsenger, skype or P2P. I don't need to do any configuration in my router for this messenger to work.
Is there any idea, example , link how these messenger connect without any router configuration from client side. I read lot of forum but not clear how can I do it. I know how to connect two machine using socket which assumes, machines has public IP address or within local network.
I will really appreciate your idea/ suggession.
Thank you.
|
|
|
|
|
UPnp or Nat search for this on Google and yoju will understand how it works.
In fact it depends on your pre-configured hardware, most of the time UPnp is opened.
|
|
|
|
|
Hi,
I'm trying to send an email that contains a link to verification the users email address.
My problem is how to combine the values inside the hyperlink/
This is what i wrote:
<br />
StringBuilder body = new StringBuilder();<br />
body.Append("<h1>confirm the registration by pressing the link below....</h1>");<br />
body.Append(@"<a href='http://something.aspx?userName=name&tempPass=password'> Click Here </a>");<br />
msg.Body = body.ToString();<br />
how i can replace the name and the password for ex. with-
txtName.text and txtPass.text
Please help me... 
|
|
|
|
|
You can try something like this:
StringBuilder body = new StringBuilder();
body.Append("<h1>confirm the registration by pressing the link below....</h1>");
body.Append(@"<a href='http://something.aspx?userName=");
body.Append(txtName.text);
body.Append(@"&tempPass=");
body.Append(txtPass.text);
body.Append(@"password'> Click Here </a>");
msg.Body = body.ToString();
|
|
|
|
|
How do I manipulate the Title of a Application...
Example:
if I open Firefox ... it appear title text "Firefox 3.5". Now I need to manipulate this text Control to "Firefox 3.5 Hello manipulate Text".
It should be solve on Dot.Net, but no must.
I think it need Win Api to solve it....
Thanks forward
modified on Friday, December 18, 2009 4:44 PM
|
|
|
|
|
I believe you'll need to use FindWindowEx and SetWindowText
Google for those and check out pinvoke.net and you should be able to do what you want
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I have been using XNA for about 4 months now and like many of its bubble wrapped features, however I need some decend game programming based books to bring me to speed on general game programming concepts such as oct trees (i keep hearing that phrase often).
Does anybody know some good books for my problem?
Thanks :P
|
|
|
|
|
|
Hello!
I am writing little application similar to CPUID, which have to determine some CPU parameters. I made most of it, but having problems with getting CPU codename, socket type and CPU family. I tried with WMI and SocketDesignation from Win32_Processor class, but instead of socket string I am getting CPU1. I think it's because I am running 64-bit dual-core Intel on 32-bit Vista, but I am not sure. Tried to replace SocketDesignation with UpgradeMethod and result is Slot2 . With Family from Win32_Processor I am getting Celeron. So basically the application recognizes my E5200 as Slot 2 Celeron. As I understand so far I have to use assembler method/instructions to get such a data, because C# doesn't have access to CPU instructions. BTW I am using Visual C#. So, any idea/advice how to get CPU info for supported instruction sets, CPU socket(like socket 775, 754 and so on), CPU family and CPU codename? But without using assembler if it is possible.
The other question - this application needs to test/benchmark the CPU too. Like how much MIPS and FLOPS. Again, any idea/info how to do it?
Thank you in advance.
|
|
|
|
|
I receive the following error when trying to DirectoryInfo on a Mapped network drive.
Error in DirectoryInfo. Error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'Z:\Tom\import\TxtFiles\Sub1'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
at System.IO.DirectoryInfo.GetFiles(String searchPattern, SearchOption searchOption)
at System.IO.DirectoryInfo.GetFiles(String searchPattern)
at DocumentShuttleService.Service1.DirectoryInfo(String sPath, String sFileSearch)
Note: The same routine works without an error on a local c: drive in the Windows Service.
Also, the same routine works without an error in a Windows Form on a mapped network drive, yet fails in the Windows Service.
Here is the Code snippet of routine.
public Boolean DirectoryInfo(string sPath, string sFileSearch)
{
try
{
Boolean bolFoundAMatch = false;
if (sPath != string.Empty)
{
DirectoryInfo di = new DirectoryInfo(sPath);
FileInfo[] rgFiles = di.GetFiles(sFileSearch);
foreach (FileInfo fi in rgFiles)
{
bolFoundAMatch = true;
}
if (bolFoundAMatch)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
catch (Exception ex)
{
sErrorMessage = "Error in DirectoryInfo. Error: " + ex.GetBaseException().ToString();
sRetStatusErrorLog = WriteInLog(sErrorMessage);
return false;
}
finally
{
}
}
|
|
|
|
|
Can you manually navigate to Z:\Tom\import\TxtFiles\Sub1?
|
|
|
|
|
Yes, I can manually navigate to Z:\Tom\import\TxtFiles\Sub1, and can also open it via the Start, Run, Open.
|
|
|
|
|
Hi,
I'm not sure about this, however maybe you only just created the Z: mapping and it does not yet apply to the Windows services. Make sure the mapping is marked persistent (there is a checkbox for that when you create it), then try a reboot. That might help. Or not. I'm curious to know this.
|
|
|
|
|
What account is the service running under? I'l willing to bet it's "Local System", in which case, it doesn't have access to the network drives you're mapping. Services have to login to Windows just like you do. Since I doubt your network allows any machines "Local System" account permissions to network shares, the service has to be told to run under an account that has access to those resources. Open the Services manager and get properties on your service. Click on the Logon tab in the dialog that comes up and tell it to use (as a test!) your account. When the service starts, it'll have access to everything you do.
|
|
|
|
|
I get the same exact error under the Windows Service, after resetting the Drive Mapping, setting the Service Log On credentials, and then re-booting.
Reset Drive mapping:
Drive Z:
Folder \\ServerName\Folder
Connect AS
Username : Domain\MyloginName
Password : ********
checked the -> Reconnect at Login (<-- Luc, Assuming this what you meant by 'mapping is marked persistent')
In Services
Service | Properties | Log On (Tab)
Log on as:
The account: Domain\MyloginName
Password : ********
|
|
|
|
|
If you map the drive in your logon session, the mapping does not carry over to the one the service is using.
The mapping would have to be done in a login script or some other persistance method.
BTW, you should not be using mapped drives in your service, rather UNC paths are preferred.
|
|
|
|
|
The UNC method worked without issue; therefore, for now I'm going to change all the components related to this process to use the UNC rather than a mapped network drive. NOTE: I will follow up with a reply post if I ever isolate why the same code works in the Windows Form but not in the Windows Service.
|
|
|
|
|
Tomb421 wrote: if I ever isolate why the same code works in the Windows Form but not in the Windows Service.
As Luc pointed out, the code works in your WinForms app because the mapping only exists in the process running the WinForms app. The mapping hasn't been defined in the process in which the service runs.
/ravi
|
|
|
|
|
In order to properly target this issue and increase and knowledge for all, please note the following.
In neither the Windows Forms application or the Windows Service Application is there every the creation for the Z: network mapping drive. This mapping was created externally during the booting of the pc and was created with the 'Reconnect at Log On' check true long before to the existence of the Windows Service.
The Windows Forms application or the Windows Service Application use the same routine 'DirectoryInfo' to check for the existence of a FileSearch based on the path passed to the routine. You can review this routine and the errror in the original posting.
Ravi, when you say 'The mapping hasn't been defined in the process in which the service runs.', where you thinking that the z: drive mapping was being dynamically created or is there something I am missing. Please clarify.
/Tom
|
|
|
|