|
|
Thanks for reply...
As for as i know AJAX.NET ControlToolkit can not be used in VS.NET 2003. it is only compatable with VS.NET 2005 and my applicaion is in VS.NET 2003. If you have any idea that how to use AJAX.NET in VS.NET 2003 do let me know. Thanks..
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
Are you just using the incoming value for PostedFiles.SaveAs(); ?
|
|
|
|
|
Is it possible to inherit System.Web.UI.Page in another class ? Something like
class class1:System.Web.UI.Page
{
}
public class CodebehindClass : class1
{
}
|
|
|
|
|
Yes
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Thanks, but I am getting error when I used this method. Check This[^]
|
|
|
|
|
Hi navaneeth,
I have seen your error and i will check it later. But if your want to follow the same architech then pass the session value in base class constructure via base keyword from the inherited class.
I will do some R & D and then i will inform you.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Parwej Ahamad wrote: But if your want to follow the same architech then pass the session value in base class constructure via base keyword from the inherited class.
Thanks, Ya same thing I am doing now.
|
|
|
|
|
Inherit a class from Page
public class MyPage: Page
{
}
then add a Page to your project (Add Item --> Page) and change
public partial class Patient : System.Web.UI.Page
to
public partial class Patient : MyPage
Do not change anything in *.Designer.cs.
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Thanks, I did the same thing. But when I use session inside myclass it throws error. First I got session is invalid for this context. So I tried with Context.Session, that throws Object reference error. I looks like page class is not getting instantiated when using this method. What do you say ?
|
|
|
|
|
I'd say that you can't access the Session in the constructor because it is not yet initialzed.
But I'm not sure about this
I test for a present Session in the OnInit method of my base page class.
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Urs Enzler wrote: I'd say that you can't access the Session in the constructor because it is not yet initialzed.
But that class inherits from Page. So before myclass constructor invokes, page constructor should invoke right ? So obviously session object also would have been initialized. After this process only myclass constructor will come to picture ? I think so ?
|
|
|
|
|
N a v a n e e t h wrote: But that class inherits from Page. So before myclass constructor invokes, page constructor should invoke right ? So obviously session object also would have been initialized. After this process only myclass constructor will come to picture ? I think so ?
It is surely true that the constructor of the base class is already run when your constructor is running.
But in the lifetime of a page there are a lot of states (see the different events that are fired: PreInit, Init, PreLoad, Load, ...). And I do not know when the Session object itself is initialized.
-^-^-^-^-^-
no risk no funk please vote ------>
|
|
|
|
|
Yes. Before the advent of MasterPage in 2.0, we used this trick to create a BasePage right?
|
|
|
|
|
Vasudevan Deepak Kumar wrote: Before the advent of MasterPage in 2.0, we used this trick to create a BasePage right?
Not related with master page concept. Just checking session in the class. So no need of writing session checking code on page_load. Do you have any idea on what is going wrong ?
|
|
|
|
|
hi all,
How to insert an ActiveX into browser and make it work. I have a *.dll file (WebForm)which I want to load on a web-page.
Thanks for help.
|
|
|
|
|
|
Well, I know that <object> tag helps, but here is my code:
<br />
<object id="NetronCtl" height="500" width="500" classid="http:NetronGraphLib.dll#Netron.GraphLib.UI.GraphControl" viewastext><br />
<param name="EnableContextMenu" value="true"/> <br />
</object><br />
and I do not know where to put this dll file to make it work.
|
|
|
|
|
In the project i am using i am having the following code and when i upload it to the server.Its givig me the following error in the global.cs file.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
anmar.SharpWebMail.UI.Global.getEffectiveCulture(CultureInfo ci) in global.cs:95
anmar.SharpWebMail.UI.Global.ParseCultures(Object[] cultures) in global.cs:180
anmar.SharpWebMail.UI.Global.ParseCultures(Object[] cultures) in global.cs:177
anmar.SharpWebMail.UI.Global.Application_AcquireRequestState() in global.cs:50
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +41
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
The code in global.cs file is
using System;
[assembly: log4net.Config.XmlConfigurator()]
namespace anmar.SharpWebMail.UI
{
public class Global : System.Web.HttpApplication {
protected static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected static System.Globalization.CultureInfo invariant = null;
protected static System.Collections.Specialized.HybridDictionary availablecultures;
protected static System.Resources.ResourceManager resources = null;public void Application_Start ( System.Object sender, System.EventArgs args ) {
initConfig();
}
public void Application_Error ( System.Object sender, System.EventArgs args ) {
if ( log.IsErrorEnabled ) log.Error ( "Application_Error", Server.GetLastError() );
#if !DEBUG
Server.ClearError();
#endif
}
public virtual void Application_AcquireRequestState() {
// For each request initialize the culture values with the
// user language as specified by the browser.
System.String[] lang = new System.String[]{Request.QueryString["lang"], null};
if ( this.Context.Session!=null && this.Session["effectiveculture"]!=null )
lang[1] = this.Session["effectiveculture"].ToString();
System.Globalization.CultureInfo culture = this.ParseCultures ( lang, Request.UserLanguages );
if ( culture==null )
culture = invariant;
if ( culture!=null && lang[1]!=culture.Name ) {
if ( !culture.IsNeutralCulture )
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
if ( this.Context.Session!=null ) {
Session["resources"] = resources.GetResourceSet(culture, true, true);
Session["effectiveculture"] = getEffectiveCulture(culture);
}
}
}
public void Session_Start ( System.Object sender, System.EventArgs args ) {
// Inbox Object
anmar.SharpWebMail.CTNInbox inbox = new anmar.SharpWebMail.CTNInbox();
if ( Application["sharpwebmail/read/inbox/sort"]!=null )
inbox.SortExpression = Application["sharpwebmail/read/inbox/sort"].ToString();
Session["inbox"] = inbox;
Session["sharpwebmail/read/message/temppath"] = parseTempFolder(Application["sharpwebmail/read/message/temppath"], Session.SessionID);Session["sharpwebmail/send/message/temppath"] = parseTempFolder(Application["sharpwebmail/send/message/temppath"], Session.SessionID);
}
public void Session_End ( System.Object sender, System.EventArgs args ) {
// Clean up temp files
cleanTempFolder(Session["sharpwebmail/read/message/temppath"]);cleanTempFolder(Session["sharpwebmail/send/message/temppath"]);
}
private void cleanTempFolder ( System.Object value ) {
try {
if ( value!=null ) {
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo (value.ToString());
if ( dir.Exists )
dir.Delete(true);dir=null;
}
} catch( System.Exception e ) {
if ( log.IsErrorEnabled )log.Error("Error cleanling up dir", e);
}
}
public System.String getEffectiveCulture ( System.Globalization.CultureInfo ci ) {
System.String culture = System.String.Empty;
if ( !availablecultures.Contains(ci.Name) && !ci.Equals(System.Globalization.CultureInfo.InvariantCulture) ) culture = this.getEffectiveCulture(ci.Parent);
else
culture = ci.Name;
return culture;
}
private void initConfig () {
Application["product"] = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
Application["version"] = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
resources = new System.Resources.ResourceManager("SharpWebMail", System.Reflection.Assembly.GetExecutingAssembly());
Application["resources"] = resources;
System.Collections.Hashtable config = (System.Collections.Hashtable)System.Configuration.ConfigurationSettings.GetConfig("sharpwebmail");
foreach ( System.Collections.DictionaryEntry item in config ) {
Application.Add(item.Key.ToString(), item.Value);
}
config = null;
if ( Application["sharpwebmail/send/addressbook"]!=null ) {
Application["sharpwebmail/general/addressbooks"] = true;
}
if ( (bool)Application["sharpwebmail/read/message/useserverencoding"] ) {anmar.SharpMimeTools.SharpMimeHeader.EncodingDefault = System.Text.Encoding.Default;
}
TestAvailableCultures();
System.Collections.SortedList availablecultures_values = new System.Collections.SortedList(availablecultures.Count);foreach ( System.Collections.DictionaryEntry item in availablecultures ) {
availablecultures_values.Add(item.Value, item.Key);
}
Application["AvailableCultures"] = availablecultures_values;
initInvariantCulture();
Application["sharpwebmail/read/message/temppath"] = parseTempFolder(Server.MapPath("/"), Application["sharpwebmail/read/message/temppath"]);Application["sharpwebmail/send/message/temppath"] = parseTempFolder(Server.MapPath("/"), Application["sharpwebmail/send/message/temppath"]);
}
private void initInvariantCulture() {
if ( invariant==null )
ParseInvariant(Application["sharpwebmail/general/default_lang"].ToString());
if ( invariant==null )
ParseInvariant("en");
if ( invariant==null ) { invariant = System.Globalization.CultureInfo.InvariantCulture;
// Set the first available culture as the default one
if ( availablecultures.Count>0 ) {
System.Collections.IDictionaryEnumerator enumerator = availablecultures.GetEnumerator();
if ( enumerator.MoveNext() )
invariant = ParseCultureSpecific((string)enumerator.Key);
enumerator = null;
}
}
}
private System.Globalization.CultureInfo ParseCulture ( System.String culturename ) {
System.Globalization.CultureInfo culture = null;
try {
culture = new System.Globalization.CultureInfo(culturename);
} catch ( System.Exception e ) {
if ( log.IsErrorEnabled )
log.Error("Error parsing culture", e);
}
return culture;
}
private System.Globalization.CultureInfo ParseCultureSpecific ( System.String culturename ) {
if ( culturename.IndexOf(';')>0 )
culturename = culturename.Remove(culturename.IndexOf(';'), culturename.Length - culturename.IndexOf(';'));
System.Globalization.CultureInfo culture = null;
try {
culture = System.Globalization.CultureInfo.CreateSpecificCulture(culturename);
if ( culturename.Length>0 && culture.Equals(System.Globalization.CultureInfo.InvariantCulture) )
culture = ParseCulture(culturename);
} catch ( System.Exception e ) {
if ( log.IsErrorEnabled )
log.Error("Error parsing specific culture", e);
}
return culture;
}
private System.Globalization.CultureInfo ParseCultures ( params System.Object[] cultures ) {
System.Globalization.CultureInfo culture = null;
if ( cultures!=null ) {
foreach ( System.Object item in cultures ) {
if ( item==null )
continue;
if ( item is System.Array )
culture = ParseCultures(item as System.Object[]);
else if ( item is System.String )
culture = this.ParseCultureSpecific(item.ToString());
if ( culture!=null && getEffectiveCulture(culture).Length>0 ) break;
else
culture = null;
}
}
return culture;
}
private void ParseInvariant ( System.String culture ) {
invariant = ParseCulture(culture);
if ( invariant!=null ) {
culture = getEffectiveCulture(invariant);
if ( culture.Length>0 )
invariant = ParseCultureSpecific(culture);
else
invariant = null;
}
}
private System.String parseTempFolder( System.Object prefix, System.Object sufix ) {
// Temp folder
if ( prefix!=null && sufix!=null && !prefix.Equals(System.String.Empty) && !sufix.Equals(System.String.Empty) ) return System.IO.Path.Combine (prefix.ToString(), sufix.ToString());
else
return null;
}
private void TestAvailableCultures() {
availablecultures = new System.Collections.Specialized.HybridDictionary();
foreach ( System.Globalization.CultureInfo item in System.Globalization.CultureInfo.GetCultures( System.Globalization.CultureTypes.AllCultures) ) {if ( !item.Equals(System.Globalization.CultureInfo.InvariantCulture) && !availablecultures.Contains(item.Name) && resources.GetResourceSet(item, true, false)!=null )
availablecultures.Add(item.Name, item.EnglishName);
}
}
}
}
What is the reason for this error? How to solve it? I am using VS2005 ASP.net 2.0
|
|
|
|
|
anmar.SharpWebMail.UI.Global.ParseCultures(Object[] cultures) in global.cs:180
You think someone is going to count through 180 lines of code to work out which one has the error ? I did see some messy code in the little I managed to wade through, but you'll have to try a little harder first ( use the debugger, tell us what lines blow up, etc )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The error is shown in the following part of code where the culture object is accessed.But i could not find anything wrong in creation of instance of the culture class.
public System.String getEffectiveCulture ( System.Globalization.CultureInfo ci ) {
System.String culture = System.String.Empty;
if ( !availablecultures.Contains(ci.Name) && !ci.Equals(System.Globalization.CultureInfo.InvariantCulture) )
culture = this.getEffectiveCulture(ci.Parent);
else
culture = ci.Name;
return culture;
}
|
|
|
|
|
Which of these lines blows up ? Which part of this is null, or returns null ? It seems most likely that ci is null, really.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
please provide explanation what is difference between serializable class and class in C#.net? in which case serializable class is used
|
|
|
|
|
A serialisable class is marked as such, and it's members appropriately marked. It's used when you want your class to be able to be serialised.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I am wondering whats new with the validation controls in ASP.Net 2.0. Because I am able to see all the validation controls that are available in VS2005 are also available in VS2003. So whats new with them. When I was browsing MSDN I have seen the below sentence:
"Validator controls can now be grouped, which allows you to selectively enable validation for some controls"
So can some one please let me know whats new with validation controls in ASP.Net2.0
Thanks in advance:
Rakesh
|
|
|
|