|
Thanks a lot Abhishek..
it worked... , by commenting that line in .js file does it affects any where else?
Thanks a a lot again..
Murali
|
|
|
|
|
I dont know budd.. Well, but if you see any close button which closes the popup, I think there must not be any problem. The code is just used to add an eventhandler for the transparent background..
I never used the control, but just read the code and found out where it is done..
|
|
|
|
|
Thanks buddy.. i dont think commenting those lines would effect..
|
|
|
|
|
use the following script where div1 is the id of popup and its height=100px n width =200px
<script type="text/javascript">
function s(e)
{
var x=event.clientX;
var y=event.clientY;
if((x<200||x>400)||(y<200||y>300))
document.getElementById("div1").style.display="none";
}
document.onmousedown=s;
function show()
{
document.getElementById("div1").style.display="block";
}
</script>
regards
Ankur Sharma
ankursharma.niit@gmail.com
|
|
|
|
|
Hi All,
I want to enhance my skill set i have experience in ASP.Net(C#) and window application. So i want to know what should i learn (WPF,WCF,Silverlight) so that it helpful for my career
Sorry if this is wrong place but i find so many expert here
Thanks,
Rajesh
|
|
|
|
|
Yes, this is obviously the wrong place. WPF seems like a winner to me, but Silverlight piggy backs your ASP.NET experience nicely, so I'd say start there.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hi,
now a days flex is coming up nicely its a adobe product so this is very useful with java ..Adobe also released flex for .net ..
what is chances of Flex with .net
Thanks
rajesh
|
|
|
|
|
I m working on a web application in which i want users to upload their files.
while testing this function i m not able to upload files more than 1.5MB in size.
other files of small size get easily uploaded.
the only reply i get is
"Internet Explorer cannot display the webpage"
modified 6-Jun-21 21:01pm.
|
|
|
|
|
I guess you need to configure your web.config to give the file size.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
try this in system.web tag in web.config file....
<httpruntime executiontimeout="900" maxrequestlength="10000"
="" requestlengthdiskthreshold="80" usefullyqualifiedredirecturl="false" minfreethreads="8" minlocalrequestfreethreads="4" apprequestqueuelimit="5000" enablekerneloutputcache="true" enableversionheader="true" requirerootedsaveaspath="true" enable="true" shutdowntimeout="90" delaynotificationtimeout="5" waitchangenotification="0" maxwaitchangenotification="0" enableheaderchecking="true" sendcachecontrolheader="true" apartmentthreading="false">;
in this maxRequestLength="10000" set the maximum size of file to upload in MB
|
|
|
|
|
Hi,im using a standard ASP.NET AJAX to run methods from my webservice.
I learned how from asp.net's website.
The problem im having is that sometimes(and only sometimes) when two people load the site at the same time, one of them will just freeze and will never receive the result from the WS.
Heres the error that the browser catches:
if (!result || typeof(result.d) === "undefined") {
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceInvalidJsonWrapper, methodName));
}
What I cant understand is why it sometimes works fine, and other times not.
Thanks.
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
Sounds like a race condition to me.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hmmm, looks like it could be but theres nothing too complicated about it and theres no shared resources
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
Any help on this error??
This happens when I run the server with ID_A and try to run the client with ID_B .. this is an attempt to try impersonation
System.TypeInitializationException was unhandled
Message="The type initializer for 'System.Runtime.Remoting.Identity' threw an exception."
Source="mscorlib"
TypeName="System.Runtime.Remoting.Identity"
StackTrace:
Server stack trace:
at System.Runtime.Remoting.Identity.RemoveAppNameOrAppGuidIfNecessary(String uri)
at System.Runtime.Remoting.IdentityHolder.MakeURIKey(String uri)
at System.Runtime.Remoting.IdentityHolder.ResolveIdentity(String URI)
at System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String URI)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.Object.FieldGetter(String typeName, String fieldName, Object& val)
at ns_application.ns_client.cls_client.Main(String[] args) in D:\Vishwjeet\Study\Remoting_tcp\ConsoleApplication2\client.cs:line 64
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Security.Cryptography.CryptographicException
Message="Unknown error \"-2146893801\"."
Source="mscorlib"
StackTrace:
at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.Utils._AcquireCSP(CspParameters param, SafeProvHandle& hProv)
at System.Security.Cryptography.Utils.AcquireProvHandle(CspParameters parameters)
at System.Security.Cryptography.Utils.get_StaticProvHandle()
at System.Security.Cryptography.RNGCryptoServiceProvider..ctor(CspParameters cspParams)
at System.Runtime.Remoting.Identity..cctor()
InnerException:
|
|
|
|
|
Are you using System.Diagonistic.Process classes to implement impersonation?
Have you placed this in your web.config
<identity impersonate="true"<br />
userName="domain\user" <br />
password="password" />
This might help u...
http://support.microsoft.com/kb/306158[^]
I think the actual problem is CryptographicException when running impersonation.
It is very hard to find the actual problem from this.
|
|
|
|
|
hmmm .. actaully this is happening while im trying remoting ..
i can give u the code .. if u wanna see ..
i am not able to find any message board for remoting .. so was trying my luck out here
|
|
|
|
|
yes why not.. Let me see your code.
Is it happening when you are connecting to a computer in LAN.. Is the domain configured correctly.. ?
Can you connect the remote machine in lan manually?
|
|
|
|
|
I am trying impersonation in remoting ..
The program runs fine when i turn off impersonation. I am running client and server both on the same machine(VISTA).
I have created the user account on the machine .. and it runs fine when i use secure channel and turn impersonation off..
I have also checked that when impersonation is off and using secure channel .. it allows only the users that i have created to logon .. otherwise it gives authentication failure.
Following is the code :
Server:
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Collections;
using System.Threading;
using System.Security.Principal;
namespace ns_application
{
namespace ns_server
{
public class cls_server
{
static void Main(string[] args)
{
//TcpChannel channel = new TcpChannel(8080);
IDictionary props = (IDictionary) new Hashtable();
IPrincipal threadPrincipal;
props.Add("port", "8080");
props.Add("secure", "true");
props.Add("impersonate", "true");
props.Add("protectionLevel", "EncryptAndSign");
//props.Add("username", "Vishwjeet");
//props.Add("password", "pwd");
//props.Add("authorizationModule", "AuthorizeUser");
//BinaryClientFormatterSinkProvider cp = new BinaryClientFormatterSinkProvider();
//BinaryServerFormatterSinkProvider sp = new BinaryServerFormatterSinkProvider();
IChannel chan = new TcpChannel(props,null,null);
ChannelServices.RegisterChannel(chan,true);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(ns_registeruser.cls_registeruser), "ApplicationMain", WellKnownObjectMode.Singleton);
threadPrincipal = Thread.CurrentPrincipal;
Console.WriteLine(threadPrincipal.Identity.Name);
Console.WriteLine(threadPrincipal.Identity.IsAuthenticated);
Console.WriteLine(threadPrincipal.Identity.AuthenticationType); Console.WriteLine("Server Started .. ");
Console.ReadLine();
}
}
}
}
Methods :
using System;
using System.Runtime.Serialization;
using System.Reflection;
using System.Data;
using System.Threading;
using System.Security.Principal;
namespace ns_application
{
namespace ns_registeruser
{
//[Serializable]
public class cls_whereitruns:MarshalByRefObject
{
private int _IDNo;
public int IDNo
{
get
{
return _IDNo;
}
set
{
_IDNo = value;
}
}
public int FutureofID()
{
IDNo = IDNo * 5;
Console.WriteLine("Calculated future of ID : {0} :::: {1} :::: {2}", IDNo,this.ToString(),AppDomain.CurrentDomain.FriendlyName);
return(IDNo);
}
public cls_whereitruns(int IDNo)
{
this.IDNo = IDNo;
Console.WriteLine("Created ID : {0} :::: {1} :::: {2}", IDNo, this.ToString(), AppDomain.CurrentDomain.FriendlyName);
}
public DataTable RMS_DIV_Data()
{
//OleDbDataAdapter dataAdapter = new TempDataSet.
TempDataSetTableAdapters.DIV60 da = new ns_application.TempDataSetTableAdapters.DIV60();
TempDataSet.__TKOCLIENT_DIV160DataTable internalTable = new TempDataSet.__TKOCLIENT_DIV160DataTable();
da.Fill(internalTable);
Console.WriteLine("Methods Connection String :: " + System.Configuration.ConfigurationManager.ConnectionStrings["ns_application.Properties.Settings.RetentionManagementSystemConnectionString"]);
Console.WriteLine(internalTable[0][0]);
return internalTable;
}
}
//public class cls_registeruser
public class cls_registeruser : MarshalByRefObject
{
public cls_whereitruns _obj = new cls_whereitruns(5);
private string _username;
public string username
{
get { return _username; }
}
public cls_registeruser()
{
_username = "Blank";
IPrincipal threadPrincipal = Thread.CurrentPrincipal;
Console.WriteLine(threadPrincipal.Identity.Name);
Console.WriteLine(threadPrincipal.Identity.IsAuthenticated);
Console.WriteLine(threadPrincipal.Identity.AuthenticationType);
Console.WriteLine("Registered User " + username);
}
public cls_registeruser(string username)
{
_username = username;
Console.WriteLine("Registered User " + username);
}
~cls_registeruser()
{
Console.WriteLine("Destructor called");
}
}
}
}
Client:
#define VISTA
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Collections;
namespace ns_application
{
namespace ns_client
{
public class cls_client
{
static void Main(string[] args)
{
IChannel channel = new TcpChannel();
ChannelServices.RegisterChannel(channel,true);
//try
//{
#if VISTA
ns_registeruser.cls_registeruser user_obj = (ns_registeruser.cls_registeruser)Activator.GetObject(typeof(ns_registeruser.cls_registeruser), "tcp://kk-pc:8080/ApplicationMain");
#else
ns_registeruser.cls_registeruser user_obj = (ns_registeruser.cls_registeruser)Activator.GetObject(typeof(ns_registeruser.cls_registeruser), "tcp://everest:8080/ApplicationMain");
#endif
IDictionary props = ChannelServices.GetChannelSinkProperties(user_obj);
//props["domain"] = "WORKGROUP11";
#if VISTA
props["tokenImpersonationLevel"] = "identification";
props["username"] = "Vishwjeet";
props["password"] = "pwd";
props["secure"] = "true";
props["protectionLevel"] = "EncryptAndSign";
Console.WriteLine(props["username"]);
#else
props["username"] = "something";
Console.WriteLine(props["username"]);
props["password"] = "hello";
#endif
Console.WriteLine("Till 1");
Console.WriteLine(user_obj._obj.FutureofID());
Console.WriteLine("Till 2");
Console.WriteLine(user_obj._obj.FutureofID());
user_obj._obj.IDNo = 35;
//Console.WriteLine("Client Connection String :: " + System.Configuration.ConfigurationManager.ConnectionStrings["ns_application.Properties.Settings.RetentionManagementSystemConnectionString"]);
Console.WriteLine(user_obj._obj.FutureofID());
Console.WriteLine(user_obj._obj.IDNo);
//Console.WriteLine(user_obj._obj.RMS_DIV_Data());
Console.WriteLine("Client Object Created for user . ." + user_obj.username);
//}
//catch (Exception e)
//{
// Console.WriteLine(e.ToString());
//}
Console.ReadLine();
}
}
}
}
|
|
|
|
|
I have login page and a main page in the asp.net application.In web.config, session Timeout value is set as 5 mins.
My requirements are as below
1.If the main page is idle for 5 mins, the session will expire and the same page will be retained. If the user tries to do some action then it has to redirect to loginpage.
bebuggiung steps
1.comes to session end event in global.asax and the retain the main page
2.comes to session start event in global.asax after the user tries to do some action.
3.check the condition and redirects to login page
2.If the session ends at the time of some action is going in the main page(eg executing a stored procedure for a long time ) then the session has to continue upto the action gets finished.Once it is completed session timeout value has to reset as original value (5 mins)
bebuggiung steps
1. Comes to session end event and assigns the session timeout value to retain the running process in the main page.
I have used the following code to do the above requirements.It is working fine in IIS V5.1 and not working in IIs 6.0 in win 2003 server
Web.config
sessionState timeout="5" mode ="InProc" cookieless ="false"
Global.asax
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["Button"] = "Started";
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
HttpContext context = HttpContext.Current;
HttpCookieCollection cookies = context.Request.Cookies;
if (cookies["starttime"] == null)
{
HttpCookie cookie = new HttpCookie("starttime", DateTime.Now.ToString());
cookie.Path = "/";
context.Response.Cookies.Add(cookie);
cookie.HttpOnly = true;
Application["Button"] = "Started";
}
else
{
if (Application["Button"] == "NotClicked" || Application["Button"] == "Error")
{
context.Response.Redirect("~/Logon.aspx");
}
}
}
void Session_End(object sender, EventArgs e)
{
if (Application["Button"] == "Clicked")
{
Session.Timeout = 60;
}
else
{
Application["Button"] = "NotClicked";
}
}
}
Main Page Load
Application["Button"] = "NotClicked";
Main Page Button Click (calling sp in this button)
Application["Button"] = "Clicked";
Please any one help me out to do the same in IIS 6.0. I have tried with worker process idle time also in application pool.
What is the difference in IIS 6.0 with IIS 5.1 using the above code with cookies? Please any one reply me as soon as possible. its very urgent....
Prasanna
|
|
|
|
|
I need to know the user IP to give the right limit to access my website,
how to detect the user IP?
and moreover, how to know which country is the user from?
thanks!
|
|
|
|
|
|
This is a good article.
|
|
|
|
|
I tried this code on my own PC, it shows the IP: 127.0.0.1
this is obviouly not right. This is not the right IP of my computer.
I saw from internet, there are also others have the same problem. then some people suggest using the following code:
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
but it shows the result as follows:
fe70::8c3:258f:3f47:fd6b%12
this is IP??
do you have more comments on this?
thank you again!!
|
|
|
|
|
I tried this code on my own PC, it shows the IP: 127.0.0.1
this is obviouly not right. This is not the right IP of my computer.
Hi you are in right direction and it is correct. It alwasy gives IP: 127.0.0.1 because you are requesting from your local machine.
When you will acces you web application via different machine then it will give the correct IP.
Anyway your code is correct.
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
thanks, I see,
but do you know
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
gives also IP? or sth else?
thank you again!!
your article is great!!
|
|
|
|