|
Hi..
I am revisiting codeproject after couple of days due to my old question.
I have done some coding in session_end in global.asx and want to execute this event , if someone closes the browser window.
I just want to have alternative to authentication.
thanks,
By:
Hemant Thaker
modified on Friday, June 25, 2010 8:17 AM
|
|
|
|
|
I believe someone posted an article or tip/trick regarding this a few days ago though can't find it now. Try searching through recent articles.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi, I have a generic list of objects returned and I want to store it in a datatable in viewstate as I have to do some in memory operations on the list (edit,update,delete)
How to go about this task ?
Mike.
|
|
|
|
|
|
Hi I have a gridview which has some records (recordID is being fetched from database)
I load the results in datatable which has columns like
--------------------------------------
RecordID | EmployeeID | Name | Address
--------------------------------------
1 4 John xyz
2 5 Smith xyz
Now user can edit the records with a checkbox list (problem is that he can reselect the existing checked items again, so the recordID is null for reselected items, I set it to zero to distinguish all new records)
So the new datatable becomes
--------------------------------------
RecordID | EmployeeID | Name | Address
--------------------------------------
0 4 John xyz (reselected rows with 0 id)
0 5 Smith xyz (reselected rows with 0 id)
0 8 Evans xxx (new record)
Now I am on form update button, I am trying to figure out how to find which records to insert and how to find records to do nothing with ? The reselected records already existing in database are creating problem for me.
Mike.
|
|
|
|
|
Hi,
I have designed ASP.NET C# 3.5 (MySQL) website and it is hosted on shared web server.
I have to send email to site users. I have written the all required code, I am sending mail from "info@mysitename.com" to yahoo or gmail but having the following exception.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Line 41: objEmail.Priority = MailPriority.Normal;
Line 42:
Line 43: SmtpClient smtpClient = new SmtpClient(smtpServer, Convert.ToInt32(port));
Line 44: System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(fromAddress, pwd);
Line 45:
Thanks
|
|
|
|
|
Dot-Net-Dev wrote: ine 43: SmtpClient smtpClient = new SmtpClient(smtpServer, Convert.ToInt32(port)); Line 44:
Everything is pretty self explanatory. The port that you are trying to use to send emails is blocked by your IT team. You need to talk to them and get it unblocked.
Further make sure you have configured SMTP configuration in Web.Config:
<system.net>
<mailSettings>
<smtp from="abc@somedomain.com">
<network host="somesmtpserver" port="25" userName="name" password="pass" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
If needed, have a look at this Microsoft Video tutorial: Use ASP.NET to Send Email from a Web Site [^]
|
|
|
|
|
i read a social.msdn[^] thread, some problem in upload image in IE7, is this true?
Raju.M
|
|
|
|
|
makhaai wrote: some problem in upload image in IE7, is this true
No! We have it and working perfectly fine.
If you read the response to the query asked, there might be path issue with the person reported.
|
|
|
|
|
i dont think the problem arise because of path, its working with IE6. and i aslo seen some threads but now one answer that question. but our thread have update please social.msdn[^]
Raju.M
|
|
|
|
|
I tried this
byte[] imageContent = (byte[])(ds2.Tables[0].Rows[0]["Signature_File"]);
MemoryStream ms1 = new MemoryStream(imageContent);
//IDataObject data = new IDataObject();
Bitmap bmp;
Image returnimage = Image.FromStream(ms1).ToString();
I am getting Parameter is not valid error
Please help
Thanks,
Raghvendra Panda
|
|
|
|
|
I m creating a website in ASP.NET using C#.through the web I want to monitor the activities of all the folders present at "C:\Inetpub\ftproot\san".User can work on any type of files and not only text files.Since we have given 1GB space (lets say) to each user, so user can do anything to utilize this space.
Now I want to monitor the activites that the user will do in his folder like creating new file, deleting an existing file or editing a file.I want to monitor user's activities because i have to keep track of the space given to the user so tht i can restrict the user to use 1GB space only and not more than that. is there any class that i can use other than FileSystemWatcher as it works only in console applications and not in webapplications?? any help would be highly apperciated.. Many thanks
|
|
|
|
|
My suggestion: create a Windows Service that runs continuously (using FileSystemWatcher), and records the activity to a database that your ASP can read/display from.
|
|
|
|
|
Thanx but it is relly necessary to create a windows service??? cant we use FSW purely with web services .. ?? if yes then how ???
|
|
|
|
|
Even if you could, think about it: do you only want to monitor folder activity while someone has your page open? And to ignore changes after they close it?
Sounds to me more like you want all activity captured, and when someone wants to look at that history, display it on a web page.
|
|
|
|
|
SENARIO: i have few folders on my FTP server, belongs to particular user. Suppose i have 10GB total space and i assign 1GB to each user i.e can accomodate 10 users having 1GB each.
now users can add/delete/edit any type of file to utilize the storage space. All i need to do is to restrict users not to exceed 1gb space for their file storage. For this i want to use FileSystemWatcher to notify me that a user had created/deleted/edited a file so that i can minimize the space from 1gb incase of creation of a file or add a space incase of deletion.
this is the piece of coding using FSW. when user gets loged-in with proper id and password, respective folder is opened (present at FTP server) where he can add/delete/edit any type of file and according to that i hav to monitor d space ulitilized by him.
but d problem is the event handlers (written in console). i dont understand what happens when this code is being runned... i dontknow how to use FSW class so that i can monitor d changes user is making in his folder.
please help plz plz ... THANX
using System.IO;
using System.Threading;
using System.Diagnostics;
public partial class _Default : System.Web.UI.Page
{
DAL conn;
string connection;
string id = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\project\\Desktop\\BE prj\\dbsan.mdb;Persist Security Info=False";
conn = new DAL(connection);
////*** Opening Respective Folder of a User ***////
DirectoryInfo directories = new DirectoryInfo(@"C:\\Inetpub\\ftproot\\san\\");
//DirectoryInfo directories = new DirectoryInfo(@"C:\");
DirectoryInfo[] folderList = directories.GetDirectories();
if (Request.QueryString["id"] != null)
id = Request.QueryString["id"];
string path = Path.Combine(@"C:\\Inetpub\\ftproot\\san\\", id);
int folder_count = folderList.Length;
for (int j = 0; j < folder_count; j++)
if (Convert.ToString(folderList[j]) == id)
{
Process p = new Process();
p.StartInfo.FileName = path;
p.Start();
}
ClsFileSystemWatcher FSysWatcher = new ClsFileSystemWatcher();
FSysWatcher.FileWatcher(path);
}
public class ClsFileSystemWatcher
{
public void FileWatcher(string InputDir)
{
using (FileSystemWatcher fsw = new FileSystemWatcher())
{
fsw.Path = InputDir;
fsw.Filter = @"*";
fsw.IncludeSubdirectories = true;
fsw.NotifyFilter =
NotifyFilters.FileName |
NotifyFilters.Attributes |
NotifyFilters.LastAccess |
NotifyFilters.LastWrite |
NotifyFilters.Security |
NotifyFilters.Size |
NotifyFilters.CreationTime |
NotifyFilters.DirectoryName;
fsw.Changed += new FileSystemEventHandler(OnChanged);
fsw.Created += new FileSystemEventHandler(OnCreated);
fsw.Deleted += new FileSystemEventHandler(OnDeleted);
fsw.Renamed += new RenamedEventHandler(OnRenamed);
fsw.Error += new ErrorEventHandler(OnError);
fsw.EnableRaisingEvents = true;
//string strOldFile = InputDir + "OldFile.txt";
//string strNewFile = InputDir + "CreatedFile.txt";
//// Making changes in existing file
//using (FileStream stream = File.Open(strOldFile, FileMode.Append))
//{
// StreamWriter sw = new StreamWriter(stream);
// sw.Write("Appending new line in Old File");
// sw.Flush();
// sw.Close();
//}
//// Writing new file on FileSystem
//using (FileStream stream = File.Create(strNewFile))
//{
// StreamWriter sw = new StreamWriter(stream);
// sw.Write("Writing First line into the File");
// sw.Flush();
// sw.Close();
//}
//File.Delete(strOldFile);
//File.Delete(strNewFile);
// Minimum time given to event handler to track new events raised by the filesystem.
Thread.Sleep(1000);
}
}
public static void OnChanged(object source, FileSystemEventArgs e)
{
Console.WriteLine("File " + e.FullPath + " :" + e.ChangeType);
}
public static void OnDeleted(object source, FileSystemEventArgs e)
{
Console.WriteLine("File " + e.FullPath + " :" + e.ChangeType);
}
public static void OnCreated(object source, FileSystemEventArgs e)
{
Console.WriteLine("File " + e.FullPath + " :" + e.ChangeType);
}
public static void OnRenamed(object source, RenamedEventArgs e)
{
Console.WriteLine("File " + e.OldFullPath + " [Changed to] " + e.FullPath);
}
public static void OnError(object source, ErrorEventArgs e)
{
Console.WriteLine("Error " + e.ToString());
}
}
|
|
|
|
|
Hi,
I have a repeater with rows with different values. When i click on a row i have to show div with Repeater row values on it.
Is there anyway to do this using JQuery or Client side functionality?
Help on this really appreciate it.
|
|
|
|
|
Imran. Mohammed wrote: Is there anyway to do this using JQuery or Client side functionality?
Yes
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Can you please let me know how to do this?
|
|
|
|
|
You didn't provide any details at all so it would be difficult to give you any useful example relevant to your solution. For instance, what is in the repeater? Table rows? Button? Image?
<table>
<tr onclick=ShowRow(rowx)>
<td>
<div id=rowx>Some values</div>
</td>
</tr>
</table>
function ShowRow(row)
{
$(row).show()
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
My repeater is as below
<br />
<tr><br />
<td class="dataRowTxt" width="110px"><br />
<%# (DataBinder.Eval(Container.DataItem, "Name"))%><br />
</td><br />
<td class="dataRowTxt" width="70px"><br />
<%# (DataBinder.Eval(Container.DataItem, "InterestRate","{0:0.000}%"))%><br />
</td><br />
<td class="dataRowTxt" width="92px"><br />
<asp:LinkButton runat="server" class="dataRowLnk" ><br />
<%# (DataBinder.Eval(Container.DataItem, "MonthlyPayment","{0:C}"))%></asp:LinkButton><br />
</tr><br />
When i click on the link button, i have to show the a div or a modal popup with values (resides at my backend) related to particular row.
Hope you are clear now.
|
|
|
|
|
|
Not from my ass...
I mean to say the data is at server or bind to repeater items.
I have gone through the Jquery dialog, but it doesn't populate the data.
Can you please help me out if you know better way of doing this?
|
|
|
|
|
Of course it doesn't populate anything, it isn't magic.
If you need to retrieve the data from the server, then make an Ajax call. The call could return formatted html to be placed inside the div or return data to be placed in a template.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Can you provide me an example of above functionality?
Thanks in advance !!
|
|
|
|