|
Hi All,
I am building a web application and would like to know if I can request a "Read Receipt" for the mails I send from the application.
Basically my application will send mails to various addresses and I want to request "Read Receipts" to find out if the message was read and on what date.
I know that in asp using CDONTS, we can do something like "Disposition-Notification-To". I am seeking the C# and ASP.NET equivalent or better if possible, without using third-party components.
Thanks in advance.
Raj
|
|
|
|
|
What are you using to generate the mail headers?
It should be possible to add either a "Disposition-Notification-To:" or a "Read-Receipt-To" into that easily enough.
Bear in mind, of course, that some sites have software that filters out one or more of these to stop spam.
Steve S
|
|
|
|
|
My program is watching for a directory on any incoming file and then move it to other places. Another application produce the data file to that directory. The problem is: my program always get the error message:
access violation
So, how can I know from program point of view that the file is accessed by another process? Is there any related API? Thanks in advance.
|
|
|
|
|
For files opened over a share, you can use NetFileEnum . For the local system, there is a function or two in the Win32 API but they are undocumented and unreferenced. There is a program called "handles" available at http://www.sysinternals.com/ntw2k/freeware/handle.shtml[^] that can show you open handles. I have examined this executable for the exports it uses but there are a lot of undocumented functions with somewhat ambiquous names.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
That's because C# (rather, the CLR) doesn't recognize the [optional] automation attribute like VB/VBScript does, and COM doesn't support overloads. If VB doesn't supply these optional parameters, though, defaults are used. These defaults for each parameter are documented so just pass those defaults for the parameters in C#. It'll have the same effect.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi, friends.
I want to ask how can I compose serval bitmaps or images into one image file?
suppose I have 2, 3, or 4 bitmap files, each file has the same contents but different color, now I want to compose them to one new bitmap. Is there any easy method or fast way to do this?
anyone has tried this application, please give me some idea... Thank you
|
|
|
|
|
Read my image processing articles. Ultimately, you probably want to merge the pixel values and build a new bitmap.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok this may or may not be possible and if it's possible then it may be so easy to do that I go and hide under the covers of my bed for asking such a stupid question but here goes.
Is it possible to create Attriobutes at runtime for a method or function. The main reason I want to do this is that I want to create an Attribute class that will work in a similiar way to the Obselete Attribute class. So my first question is - how does the Obsolete attribute work so that during compilation it causes an error if a function that has been created with the Obsolete Attribute and is then called from elsewhere in the code.
Secondly is it possible within the constructor of my attribute class to create an instance of the Obsolete attribute class and for this to then work the same way as if I had placed the Obsolete Attribute before the method/class/variable.
Thirdly can you create an Attribute at run time that you can apply to a method, in a similiar way that you can access what Attributes have been applied to a method.
Please note that where I have used method in this text please replace with Method/Class/Variable etc.
Thanks in advance if anyone has any information on this,
Mark
|
|
|
|
|
Hi Mark. There are some articles on attributes here on CodeProject that you may want to check out (do a search for "attributes"). I particularly liked this one from sadaf alvi
http://www.codeproject.com/csharp/attributes.asp[^]
I haven't tried it, but it seems reasonable that an Attribute could be created at runtime... how would it be applied? I see the GetCustomAttributes method, but nothing to set them...
|
|
|
|
|
Actually, you cannot create attributes at runtime. They represent meta-data, or data that describes data (the compiled code). They are set only by the compiler for the particular source file.
However, there are a couple ways around this. The first it so emit an assembly (see System.Reflection.Emit ) and attribute a emitted class with attributes before compiling the assembly.
The second way is to implement ICustomTypeDescriptor . For the most part, most methods can use the appropriate overloaded TypeDescriptor method that takes a bool dictating whether or not to query for said interface (that way, while you still have to implement every method, you don't have to write any custom code when you don't need to). In your implementation of ICustomTypeDescriptor.GetAttributes , return a custom set of attribute classes.
Implementing ICustomTypeDescriptor is only useful when something uses the TypeDescriptor class (or something else that uses it, like the PropertyGrid component - we the interface to custom some of this stuff in a runtime grid in our app). Of course, a class of yours could query for it, too, but usually the TypeDescriptor is sufficient.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Interesting, Heath. Good info
|
|
|
|
|
Thanks for that Heath, very useful information. At least I can rest assured that I was not being that Stupid when I asked the question...
|
|
|
|
|
the obsolete attrib is hardcoded into the compiler..
and so is the strongname key attribs and everything else that can raise compile errors..
you cannot create your own attribs that does the same..
//Roger
|
|
|
|
|
Hi anybody knows how to get the IP address of my DSL modem passing through
linksys router using .net framework in C# ????
Thanks
|
|
|
|
|
If you're linksys has the latest BIOS update, you could use the UPnP interface to query the external IP address. You'll need to find more information about UPnP in MSDN or download the SDK from the same site. There's far too much to cover on a broad topic here.
Another way - somewhat of a hack - would be to create a new process (see System.Diagnostics.Process ) to start tracert.exe and redirect its stdout. The second hop should be the IP address of your linksys's external interface. This only works if it allows pings out if firewalled.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
I am trying to do the same. As someone suggested me to use a feature in my linksys router but mine doesn't have it. Anyway, there are several ways but I did:
1. Create a simple html page which records(using script php, java, asp..) client IP and display it on the page. This page will be hosted somewhere outside your linksys router. example: http://www.somedomain.com/ip.html which will display string IP=111.112.114.115. Your code will go to that page and grab the text and parse for IP.
and Here is the code in C#
Regex regexp = new Regex("IP=[0-9]+.[0-9]+.[0-9]+.[0-9]+");
WebRequest request = WebRequest.Create("http://www.somedomain.com/ip.html");
WebResponse response = request.GetResponse();
StreamReader rd = new StreamReader(response.GetResponseStream());
string content = rd.ReadToEnd();
string myip = regexp.Match(content).ToString();
then you can split the string and get IP only.
2. The second way is to login your linksys router and go to http://192.168.1.1/status.htm
and then seach for wan IP but I still have problem with the login.
|
|
|
|
|
Thanks a lot for the reply.
I see we are at the same level.
I prefere the second option because i find kind
of useless to read the IP of the wan from outside.
I thought the same as you and I have the problem
for the login too.
I'd like to query the router with a command,
but I don't know how.
I think with a CISCO you can do it like the
old HAYES AT command of the analog modems style.
But with linksys..... ?????
Thanks I will work on the login to the 192.168.1.1 address
|
|
|
|
|
|
I chatted with the Customer support of Linksys. It seams they don't want to reveal the paramenters to login. But i think i found a guy didn't know i was talking about
http://192.168.1.1/Gozila.cgi?usrName=admin&Passwd=xxxx
but still not sure because I don't know the exact name of the parameters.
Anyhow I Copy / Modified this code from a program fount in codeproject
and I got some results.
It seems like something is not working right: when i start the program
I can even log in with the hotmail login. Maybe it just look to the password
and not the login name or I think the linksys accept any authenticated users of windows or something like that.
This is the code:
using System;
using System.Diagnostics;
using System.Drawing;
using System.Collections;
using System.IO;
using System.ComponentModel;
using System.Windows.Forms;
using mshtml;
using SHDocVw;
using System.Text.RegularExpressions;
using System.Data.OleDb;
namespace TestIENavigate
{
///
/// Summary description for Form1.
///
public class form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button butNavigate;
private System.Windows.Forms.TextBox txtDisplay;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
private InternetExplorer m_browser;
public form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.butNavigate = new System.Windows.Forms.Button();
this.txtDisplay = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// butNavigate
//
this.butNavigate.Location = new System.Drawing.Point(320, 368);
this.butNavigate.Name = "butNavigate";
this.butNavigate.Size = new System.Drawing.Size(120, 23);
this.butNavigate.TabIndex = 0;
this.butNavigate.Text = "Navigate";
this.butNavigate.Click += new System.EventHandler(this.butNavigate_Click);
//
// txtDisplay
//
this.txtDisplay.Location = new System.Drawing.Point(8, 8);
this.txtDisplay.Multiline = true;
this.txtDisplay.Name = "txtDisplay";
this.txtDisplay.Size = new System.Drawing.Size(768, 352);
this.txtDisplay.TabIndex = 1;
this.txtDisplay.Text = "";
//
// form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(784, 395);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txtDisplay,
this.butNavigate});
this.Name = "form1";
this.Text = "IE Navigate";
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new form1());
}
private void butNavigate_Click(object sender, System.EventArgs e)
{
txtDisplay.Text = "";
m_browser = new InternetExplorer();
txtDisplay.Text = explorerRead("http://192.168.1.1/Status.htm",m_browser);
}
private string explorerRead(string web_page_address,InternetExplorer ie)
{
System.Object nullObject = 0;
System.Object nullObjStr = "";
try
{
ie.Navigate(web_page_address,ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
}
catch(Exception e)
{
return null;
}
int ctr = 0;
while( ie.ReadyState!=tagREADYSTATE.READYSTATE_COMPLETE )
{
Application.DoEvents();
System.Threading.Thread.Sleep(100);
if(++ctr > 25)
{
return null;
}
}
// extract and return the text contents of the retrieved page
return (ie.Document as IHTMLDocument2).body.outerText;
}
}
}
DON'T forget to add references to .net components and COM
Microsoft.mshtml (.net)
AsxSHDocVw
SHDocVw
When you run the program the login dialog will pop-up.
Once you login and your program is running you will not to login again.
I hope this help and maybe we can go little bit further.
Thanks
|
|
|
|
|
hiiiii all...
i'm developing a web site...and my manager wanna prevent any user form certain country from accessing the (or loggon )site....example( anyone from Canada or Congo or any other country)...is there anyway to do this ??....
thx in advance
|
|
|
|
|
Hi,
With the help of "Country-to-IP Address Mappings Compiled", you can block any user by getting its IP address and matching it with against the IP in the above listing.
I hope the following link will help you.
http://www.arson-network.com/index.php?class=tutorial&subargs=75
Best of luck.
|
|
|
|
|
Hi,
I am running into a problem when trying to use the Z Buffer in my d3d app. I have code that looks similar to this…
device.Clear(ClearFlags.Target, System.Drawing.Color.Black, 1.0f, 0);
//Begin the scene
device.BeginScene();
But whenever I change it to something like this
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Black, 1.0f, 0);
//Begin the scene
device.BeginScene();
I get an error and the D3d dll throws an “error in application” exception. Does anyone have any idea on what could be causing this problem?
-Art
|
|
|
|
|
Is that the best exception you get? Have you tried putting the BeginScene call in a try/catch block and seeing if you get something more descriptive?
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
Alternatively to the other poster, you could try a little thing called "debugging" (it seems to be a quickly dying "craze") and use VS.NET's extensive debugger to view everything relevant to that exception (by examining the exception's properties and the state of objects around it). At the very least, it would give more information that could help the CP community help you. Besides, debugging is as important as actually writing the code in any application that does more than print "Hello, world" to the console or a window.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi,
I'm trying to use a string declared in a file called Settings.cs
public class Settings : System.Windows.Forms.Form<br />
{<br />
public string folderName
<br />
protected int iTCPPort;<br />
in another file called registry.cs
<br />
private void MainRegSetKey()<br />
{<br />
RegistryKey hRegistryKey = Registry.CurrentUser.CreateSubKey("Vortex");<br />
<br />
hRegistryKey.SetValue("Download_Destination",Settings.foldername);<br />
<br />
return true;<br />
In the SetValue function I can't assign foldername, have I to declare a new istance of Settings doing Settings s = new Settings(); ?
thanks in advance
Paolo Ponzano
|
|
|
|