|
je ss un etudiant comme CDA creation et développement des application intranet Extranet et mon projet de fin d etude et un mélange entre forum de discussion et site des cours numériser et cours video upload et download ben si quilqu un peu m aider si il vous plez
|
|
|
|
|
mouadel wrote: je ss un etudiant comme CDA creation et développement des application intranet Extranet et mon projet de fin d etude et un mélange entre forum de discussion et site des cours numériser et cours video upload et download ben si quilqu un peu m aider si il vous plez
What is this ? Can you please write it in English ?
|
|
|
|
|
It appears to be txt-speak French. Interesting, haven't seen that before. Asking for help with a final year project I think?
I'd rather set a challenge for an application that could translate that.
|
|
|
|
|
I used some online tool and paste his text over and translate to english. It comes like :
"A student i ss as CDA creation and development of application intranet, extranet and my project of end of study and a blend between discussion forum and site training numriser and courses video upload and download ben if quilqu a little m help if you plez"
|
|
|
|
|
I think this is what JHizzle did if he is not French (his profile says so ).
But still it doesn't make much sense.
..Go Green..
|
|
|
|
|
Nah, my french is pretty good but even so, I only got something about a final year project for his course and pretty much turned off after that.
|
|
|
|
|
Yeah of course. txtspeak in French
I thought it's only English that got affected.
..Go Green..
|
|
|
|
|
Hi all,
In my project, Parent page opens a child page using window.open method on a button click.
Child page has a method LoadDropDownList() in page_load, which is supposed to populate a drop down list in the page. LoadDropDownList method creates an object of a class from the referenced library and calls a method on that object which performs some heavy operation to get strings and populate the dropdownlist. This takes around 3-4 seconds. I release the object in the finally{} block in this method.
Now, Even if my child page is closed using (X button) immediately after its opened (before 3 seconds), the loaddropdownlist method is already initiated.
After that I open the child and close it immediately for 3-4 times aproximately and then the next time parent page is unable to open child page . IE 7 just shows running status. Probably Server experiences some heavy load due to multiple LoadDropDownList ongoing runs in the stack.
Is memory leak is happening here?
Shouldn't it stop running child's LoadDropDownList() and get read of the objects immediately after I close the form? But it's not happening. I found control returns to this method multiple times after i (opened for number of times and) closed the form respectively.
What is the remedy here? How child should stop running any method in it after it's closed?
Kind regards,
Vijay
|
|
|
|
|
Closing the browser does not tell the server anything. So the server still does all the processing initiated by the request as if nothing happened. It is not a memory leak from the browser point of view. But if only 3-4 calls to this process of yours are enough to slow down the server you really need to evaluate that method and figure out how to optimize it.
|
|
|
|
|
Vijay you say that you have a function that Binds the DropdownList. i have few questions for you.
How many times does this function call appear in your code ?
Do you Protect that Function against unnecessary post backs by doing something like
if(!Page.Ispostback)
{
}
The Slowness of your page might be caused by a lot of things , please give us more info and tell us what you are doing or share a part that binds the dropdown
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
This is a major issue which you cant do anything. Actually ASP.NET runs in request response approach. so whenever you call the server to get the dropdownlist, you are actually creating a new thread to send your request object from your browser.
Now after receiving the request object to the browser, until it sends back the response, you dont have any communication between the client and the server. At that moment, the browser shows something like "Waiting for Response... ".
If you close your browser the processing will not stop and hence your server will keep doing processing.
I think one option might be useful in this regard. You might cache the result for few seconds, so that the same request when received within a minute, it will be served from cache, rather than go and process it again. This would improve the performance of the page (only if the data is not very big)
I hope Caching would be the best solution for your problem, as there is no straightforward way to stop the thread running in the server before sending the response.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Hi All,
Newbie to ASP.Net, I created a dynamic checkboxlist that populated from a database in asp .net vb. Not sure if it is possible but I would like format the checkboxes to diplay on my page so many on each column.
Somthing like:
checkbox 1 checkbox 6
checkbox 2 checkbox 7
checkbox 3 checkbox 8
checkbox 4 checkbox 9
checkbox 5 checkbox 10
Any help greatly appreciated.
Thanks
DocHoliday.
|
|
|
|
|
Never mind I figured it out.
Thanks.
|
|
|
|
|
using System;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Security.Principal;
using System.Xml;
using Itools.Encryption;
using System.Web;
using System.Text;
using System.Text.RegularExpressions;
namespace Ashwin.DAL {
/// <summary>
/// Summary description for Util
/// </summary>
public class Util {
//Design users
//adriaanse.a
//allinsmith.w
private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"]
private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M=";
private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ==";
private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings;
private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings;
/// <summary>
/// Returns the username without the domain of the current logged in user.
/// </summary>
/// <param name="User">Current logged in user, example CN\ashwin.k</param>
/// <returns>Returns the username without the domain of the current logged in user. </returns>
public static string GetSimpleUsername(IPrincipal User) {
//setup user array to split username into domain and username
#if DEBUG
return whoami;
#endif
string[] user;
// define which character is seperating fields
char[] splitter = { '\\' };
//perform split
user = User.Identity.Name.Split(splitter);
//check to see if no domain exists for user
if (user.Length < 2) {
return user[0];
} else {
return user[1];
}
}
/// <summary>
/// Method to make sure that user's inputs are not malicious
/// </summary>
/// <param name="text">User's Input</param>
/// <param name="maxLength">Maximum length of input</param>
/// <returns>The cleaned up version of the input</returns>
public static string InputText(string text, int maxLength) {
text = text.Trim();
if (string.IsNullOrEmpty(text))
return string.Empty;
if (text.Length > maxLength)
text = text.Substring(0, maxLength);
text = Regex.Replace(text, "[\\s]{2,}", " "); //two or more spaces
text = Regex.Replace(text, "(<[b|B][r|R]/*>)+|(<[p|P](.|\\n)*?>)", "\n"); //<br>
text = Regex.Replace(text, "(\\s*&[n|N][b|B][s|S][p|P];\\s*)+", " "); //
text = Regex.Replace(text, "<(.|\\n)*?>", string.Empty); //any other tags
text = text.Replace("'", "''");
return text;
}
/// <summary>
/// Returns true if the user is a member of any role in the list,
/// or any group in the list with the User's domain apppended in front of each individual role name.
/// If the user it not a member of any role false if returned
/// </summary>
/// <param name="usr">User object to check.</param>
/// <param name="roles">Comma Seperated list of role names</param>
/// <returns>True if user is a member of any role otherwise return false.</returns>
public static bool isInAnyRole(IPrincipal usr, string roles) {
//define the splitter
char[] splitter = { ',' };
//get user's domain
string domain = GetUserDomain(usr);
// create an array of roles
string[] roleArray = roles.Split(splitter);
for (int i = 0; i < roleArray.Length; ++i) {
if (usr.IsInRole(roleArray[i]) || usr.IsInRole(domain + '\\' + roleArray[i])) {
return true;
}
}
return false;
}
/// <summary>
///
/// </summary>
/// <param name="User"></param>
/// <returns></returns>
public static string GetUserDomain(IPrincipal User) {
//setup user array to split username into domain and username
string[] user;
// define which character is seperating fields
char[] splitter = { '\\' };
//perform split
user = User.Identity.Name.Split(splitter);
//check to see if no domain exists for user
if (user.Length < 2) {
return "";
} else return user[0];
}
/// <summary>
/// Get the Server name.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public static string GetServerName(HttpContext context) {
string ret;
string port = context.Request.ServerVariables["SERVER_PORT"];
ret = GetConfigValue("ServerName") + ":" + port;
if (port == "80") {
ret = GetConfigValue("ServerName") + context.Request.ApplicationPath;
}
return "http://" + ret;
}
/// <summary>
/// Looks through LDAP groups for a given name and determines if the user is
/// in that LDAP group
/// </summary>
/// <param name="name"></param>
/// <param name="GroupName"></param>
/// <returns></returns>
public static bool IsUserInLDAPGroup(string name, string GroupName) {
try {
XmlDocument doc = new XmlDocument();
doc.Load("http://groupservice.internal.pg.com/GDSGroupService.jrun?op=ismember&accountshortname=" +
name.Replace("-", ".").ToLower() +
"&groupdn=cn=" + GroupName.ToLower() +
",ou=groups,o=world&expand=true");
return bool.Parse(doc.GetElementsByTagName("ismember")[0].InnerText);
} catch {
return false;
}
}
/// <summary>
/// Return a value from the web.config file or the app.config file
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static string GetConfigValue(string name) {
Cryptography crypto = new Cryptography();
string ret;
string temp;
if (AppSettings.GetType().Equals(typeof(System.Configuration.KeyValueConfigurationCollection))) {
temp = ((System.Configuration.KeyValueConfigurationCollection)AppSettings)[name].Value;
} else {
temp = ((System.Collections.Specialized.NameValueCollection)AppSettings)[name];
}
//Find out if we need to decrypt the value.
switch (name) {
case "WebServicePswd":
case "DBPassword":
case "ContentMonitorDBPassword":
temp = crypto.Decrypt(temp, encKey, encVector);
break;
}
ret = temp;
//return the value
return ret;
}
/// <summary>
/// Return Encrypted value for the specified value
/// </summary>
/// <param name="value"></param>
/// <returns>returns encrypted value</returns>
public static string EncryptValue(string value)
{
Cryptography crypto = new Cryptography();
return crypto.Encrypt(value, encKey, encVector);
}
/// <summary>
/// Return Decrypted value for the specified value
/// </summary>
/// <param name="value"></param>
/// <returns>returns decrypted value</returns>
public static string DecryptValue(string value)
{
Cryptography crypto = new Cryptography();
return crypto.Decrypt(value, encKey, encVector);
}
/// <summary>
/// Function to return a valid string representing a date
/// </summary>
/// <param name="sValue"></param>
/// <returns></returns>
public static string GetValidDate(string sValue) {
if (sValue.Length > 0) {
return DateTime.Parse(sValue).ToShortDateString() + " " + DateTime.Parse(sValue).ToShortTimeString();
} else {
return "";
}
}
/// <summary>
/// Return a valid date as a DateTime object
/// </summary>
/// <param name="sValue"></param>
/// <returns></returns>
public static DateTime GetValidDateAsDateTime(string sValue) {
if (sValue.Length > 0) {
return DateTime.Parse(sValue);
} else {
return DateTime.Today;
}
}
/// <summary>
/// Return a valid integer or 0
/// </summary>
/// <param name="sValue"></param>
/// <returns></returns>
public static int GetValidInt(string sValue) {
if (sValue.Length > 0) {
if (sValue == "True") return 1;
if (sValue == "False") return 0;
return Int32.Parse(sValue);
} else {
return 0;
}
}
/// <summary>
/// Return a valid integer or 0
/// </summary>
/// <param name="sValue"></param>
/// <returns></returns>
public static decimal GetValidDecimal(string sValue) {
if (sValue.Length > 0) {
return Decimal.Parse(sValue);
} else {
return 0;
}
}
/// <summary>
/// Returns a valid interger or 0 from a Dropdown list
/// </summary>
/// <param name="cbo"></param>
/// <returns></returns>
public static int GetValidIntForCombo(DropDownList cbo) {
int ret = 0;
if (cbo.SelectedIndex > 0) {
ret = GetValidInt(cbo.SelectedValue);
}
return ret;
}
/// <summary>
/// Gets item values from a list box and returns them in a string array.
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public static string[] GetSelectedItems(ListBox list) {
string items = "";
foreach (ListItem item in list.Items) {
if (item.Selected) {
items += (items.Length > 0 ? "|" : "") + item.Value;
}
}
if (items.Length == 0) {
return null;
}
return items.Split('|');
}
/// <summary>
/// Gets item values from a list box and returns them in a string of comma sepereated values.
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public static string GetSelectedItemsFromList(ListBox list) {
string items = "";
foreach (int index in list.GetSelectedIndices()) {
items += (items.Length > 0 ? "," : "") + list.Items[index].Value;
}
if (items.Length == 0) {
return string.Empty;
}
return items;
}
public static System.Collections.ICollection AppSettings {
get { return appSettings; }
set { appSettings = value; }
}
public static System.Configuration.ConnectionStringSettingsCollection ConnectionStrings {
get { return connStrings; }
set { connStrings = value; }
}
/// <summary>
/// Returns the exception message + stack trace so it can be logged
/// </summary>
/// <param name="ex">exception</param>
/// <returns>text containing message + stack trace</returns>
static public string returnExecptionText(System.Exception ex) {
Exception unhandledException = ex;
StringBuilder error = new StringBuilder();
while (unhandledException != null) {
error.Append("An unhandled exception occurred: " + unhandledException.Message);
error.Append(" StackTrace: ");
error.Append(unhandledException.StackTrace);
unhandledException = unhandledException.InnerException;
}
return error.ToString();
}
/// <summary>
/// Formats the date as 1-JUN-2006
/// </summary>
/// <param name="date">The Date to format</param>
/// <returns></returns>
public static string DisplayedDate(string date) {
string ret = "";
try {
ret = DateTime.Parse(date).ToString("dd-MMM-yyyy");
} catch { }
return ret;
}
/// <summary>
/// converts string array into the integer array
/// </summary>
/// <param name="strArray"></param>
/// <returns></returns>
public static int[] ConvertStringArrayToIntArray(string[] strArray) {
int[] intArray;
intArray = Array.ConvertAll<string, int>(strArray, new Converter<string, int>(ConvertStringToInt));
return intArray;
}
/// <summary>
/// converts integer array into the string array
/// </summary>
/// <param name="intArray"></param>
/// <returns></returns>
public static string[] ConvertIntArrayToStringArray(int[] intArray) {
string[] strArray;
strArray = Array.ConvertAll<int, string>(intArray, new Converter<int, string>(ConvertIntToString));
return strArray;
}
/// <summary>
/// used as predicate to convert the value fron int to string
/// </summary>
/// <param name="intParameter"></param>
/// <returns></returns>
private static string ConvertIntToString(int intParameter) {
return intParameter.ToString();
}
/// <summary>
/// used as predicate to convert the value fron string to int
/// </summary>
/// <param name="strParameter"></param>
/// <returns></returns>
private static int ConvertStringToInt(string strParameter) {
return int.Parse(strParameter);
}
}
}
Exception thrown, Please help.
|
|
|
|
|
Could you sling that into a code block please, and tell us which line the exception is being thrown at as well as what the exception message says.
|
|
|
|
|
No one is going to read this unformatted drivel. Please format any code, as per CP guidelines, and only include what is relevant. And no, not all of this is relevant to your issue.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Enter your code between "code block"
|
|
|
|
|
using System;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Security.Principal;
using System.Xml;
using Itools.Encryption;
using System.Web;
using System.Text;
using System.Text.RegularExpressions;
namespace Ashwin.DAL
{
public class Util
{
private static readonly string whoami = "ashwin.k";
private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M=";
private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ==";
private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings;
private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings;
public static string GetSimpleUsername(IPrincipal User)
{
#if DEBUG
return whoami;
#endif
string[] user;
char[] splitter = { '\\' };
user = User.Identity.Name.Split(splitter);
if (user.Length < 2)
{
return user[0];
}
else
{
return user[1];
}
}
public static string InputText(string text, int maxLength)
{
text = text.Trim();
if (string.IsNullOrEmpty(text))
return string.Empty;
if (text.Length > maxLength)
text = text.Substring(0, maxLength);
text = Regex.Replace(text, "[\\s]{2,}", " ");
text = Regex.Replace(text, "(<[b|B][r|R]/*>)+|(<[p|P](.|\\n)*?>)", "\n");
text = Regex.Replace(text, "(\\s*&[n|N][b|B][s|S][p|P];\\s*)+", " ");
text = Regex.Replace(text, "<(.|\\n)*?>", string.Empty);
text = text.Replace("'", "''");
return text;
}
public static bool isInAnyRole(IPrincipal usr, string roles)
{
char[] splitter = { ',' };
string domain = GetUserDomain(usr);
string[] roleArray = roles.Split(splitter);
for (int i = 0; i < roleArray.Length; ++i)
{
if (usr.IsInRole(roleArray[i]) || usr.IsInRole(domain + '\\' + roleArray[i]))
{
return true;
}
}
return false;
}
public static string GetUserDomain(IPrincipal User)
{
string[] user;
char[] splitter = { '\\' };
user = User.Identity.Name.Split(splitter);
if (user.Length < 2)
{
return "";
}
else return user[0];
}
public static string GetServerName(HttpContext context)
{
string ret;
string port = context.Request.ServerVariables["SERVER_PORT"];
ret = GetConfigValue("ServerName") + ":" + port;
if (port == "80")
{
ret = GetConfigValue("ServerName") + context.Request.ApplicationPath;
}
return "http://" + ret;
}
public static bool IsUserInLDAPGroup(string name, string GroupName)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load("http://groupservice.internal.pg.com/GDSGroupService.jrun?op=ismember&accountshortname=" +
name.Replace("-", ".").ToLower() +
"&groupdn=cn=" + GroupName.ToLower() +
",ou=groups,o=world&expand=true");
return bool.Parse(doc.GetElementsByTagName("ismember")[0].InnerText);
}
catch
{
return false;
}
}
public static string GetConfigValue(string name)
{
Cryptography crypto = new Cryptography();
string ret;
string temp;
if (AppSettings.GetType().Equals(typeof(System.Configuration.KeyValueConfigurationCollection)))
{
temp = ((System.Configuration.KeyValueConfigurationCollection)AppSettings)[name].Value;
}
else
{
temp = ((System.Collections.Specialized.NameValueCollection)AppSettings)[name];
}
switch (name)
{
case "WebServicePswd":
case "DBPassword":
case "ContentMonitorDBPassword":
temp = crypto.Decrypt(temp, encKey, encVector);
break;
}
ret = temp;
return ret;
}
public static string EncryptValue(string value)
{
Cryptography crypto = new Cryptography();
return crypto.Encrypt(value, encKey, encVector);
}
public static string DecryptValue(string value)
{
Cryptography crypto = new Cryptography();
return crypto.Decrypt(value, encKey, encVector);
}
public static string GetValidDate(string sValue)
{
if (sValue.Length > 0)
{
return DateTime.Parse(sValue).ToShortDateString() + " " + DateTime.Parse(sValue).ToShortTimeString();
}
else
{
return "";
}
}
public static DateTime GetValidDateAsDateTime(string sValue)
{
if (sValue.Length > 0)
{
return DateTime.Parse(sValue);
}
else
{
return DateTime.Today;
}
}
public static int GetValidInt(string sValue)
{
if (sValue.Length > 0)
{
if (sValue == "True") return 1;
if (sValue == "False") return 0;
return Int32.Parse(sValue);
}
else
{
return 0;
}
}
public static decimal GetValidDecimal(string sValue)
{
if (sValue.Length > 0)
{
return Decimal.Parse(sValue);
}
else
{
return 0;
}
}
public static int GetValidIntForCombo(DropDownList cbo)
{
int ret = 0;
if (cbo.SelectedIndex > 0)
{
ret = GetValidInt(cbo.SelectedValue);
}
return ret;
}
public static string[] GetSelectedItems(ListBox list)
{
string items = "";
foreach (ListItem item in list.Items)
{
if (item.Selected)
{
items += (items.Length > 0 ? "|" : "") + item.Value;
}
}
if (items.Length == 0)
{
return null;
}
return items.Split('|');
}
public static string GetSelectedItemsFromList(ListBox list)
{
string items = "";
foreach (int index in list.GetSelectedIndices())
{
items += (items.Length > 0 ? "," : "") + list.Items[index].Value;
}
if (items.Length == 0)
{
return string.Empty;
}
return items;
}
public static System.Collections.ICollection AppSettings
{
get { return appSettings; }
set { appSettings = value; }
}
public static System.Configuration.ConnectionStringSettingsCollection ConnectionStrings
{
get { return connStrings; }
set { connStrings = value; }
}
static public string returnExecptionText(System.Exception ex)
{
Exception unhandledException = ex;
StringBuilder error = new StringBuilder();
while (unhandledException != null)
{
error.Append("An unhandled exception occurred: " + unhandledException.Message);
error.Append(" StackTrace: ");
error.Append(unhandledException.StackTrace);
unhandledException = unhandledException.InnerException;
}
return error.ToString();
}
public static string DisplayedDate(string date)
{
string ret = "";
try
{
ret = DateTime.Parse(date).ToString("dd-MMM-yyyy");
}
catch { }
return ret;
}
public static int[] ConvertStringArrayToIntArray(string[] strArray)
{
int[] intArray;
intArray = Array.ConvertAll<string, int>(strArray, new Converter<string, int>(ConvertStringToInt));
return intArray;
}
public static string[] ConvertIntArrayToStringArray(int[] intArray)
{
string[] strArray;
strArray = Array.ConvertAll<int, string>(intArray, new Converter<int, string>(ConvertIntToString));
return strArray;
}
private static string ConvertIntToString(int intParameter)
{
return intParameter.ToString();
}
private static int ConvertStringToInt(string strParameter)
{
return int.Parse(strParameter);
}
}
}
|
|
|
|
|
Why?
You have done nothing to help the OP learn the proper etiquette here. You have also added more useless space to the forum since not all of this code directly pertains to the question.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I am populating the repeater control on item_databound, i have button on click of that i need to retrieve the data from the repeater and put in hidden field. appreciate help on this.
appreciate code snippet for this. using ASP.net 2.0 code behind is c#.
Thanks,
DB
ashish
|
|
|
|
|
foreach(var item in Repeater.Items)
{
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
can we display image in ajax editor control?
|
|
|
|
|
Where is Ajax editor control ??
Is it custom made or in ajax toolkit ?
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
it is in ajax toolkit.
i want to just make like orkut scrap replay editor so i can add image in add control.
i hv done all except that image display.
hv u any idea abt this if yes then plz suggest me.
thank's
|
|
|
|
|
|