|
saqib82 wrote: what are the reasons for that error.
(1) Common mistake when working with code behind classes.
Remember! Codebehinds arn't handled the same way as inline/ pages!
You need to declare EVERY control you want to interact with in the codebehind class
Do this just after the Inherits statement:
<code>Public Class PageOne
Inherits System.Web.UI.Page
Protected WithEvents litOne As System.Web.UI.WebControls.Literal
...</code>
(2) Bad Scoping.
<code>Sub Page_Load(ByVal e As System.EventArgs) Handles MyBase.Load
Private strHello As String
End Sub
Sub Button1_Click(ByVal e As System.EventArgs) Handles Button1.Click
strHello = "Hello!"
End Sub</code>
(3) bad inits and constructs:
Remember, some classes have constuctors
Consider DirectoryInfo:
<code>Sub Page_Load() ....
Dim dirInfo As System.IO.DirectoryInfo
dirInfo.GetDirectory("C:\")
End Sub</code>
In the above example, we've only defined dirInfo *AS* a DirectoryInfo class, we haven't actually created it
So we need to do this instead:
<code>Sub Page_Load() ....
Dim dirInfo As System.IO.DirectoryInfo
dirInfo = New System.IO.DirectoryInfo("C:\")
End Sub</code>
That should do it....
Remember, ALWAYS refer to the MSDN Library when enquiring about classes and their initilisation (sp?) methods.... why trust some "1337 script kiddie!" site when you've got the official reference at http://www.msdn.com ? Or better yet, get the compiled version on CD, don't need to worry about long download times or the constant "was this article of any use to you?" screen.
HTH
-1337_d00d
<div class="ForumSig">SSK.</div>
|
|
|
|
|
Hi
I'm trying to create a website with a logon screen and two parts, a public area and a member area. The first page will be the public area. The user then clicks login and is directed to a login page which checks logins with a database. Once the user is logged in they need to be directed to a sharepoint site. Here is my problem...I need the Sharepoint site to use the login info from the login page. I would imagine Sharepoint uses session variables to store the login info, does anybody know what these are?
Thanks
Scott
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Hi, When i compile my web site, i facing this error
The type 'CP_uc_LstUsrControl' exists in both
'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\WebSite1\eaf01500\1857dc0a\App_Web_6jm_c6gh.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\WebSite1\eaf01500\1857dc0a\App_Web_enmtx5tr.dll' i:\work\portals\WebSite1\CP\User\uc_UserTypeControl.ascx
please Help Me
|
|
|
|
|
i think u r using CP_uc_LstUsrControl named control in both Usercontrol & webform. Rename the control name at one place & try...
Ramana
|
|
|
|
|
Remove ur all file in Temp folder c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ and nothing to use now u run if not come reply me i will tell some other idea
|
|
|
|
|
thank you for answers.
this problem solved. i had 2 UserControl with different name but this controls inherited from the same class.
but i have other problem now. when i try to deploy website, i facing this error in last of compilation : "aspnet_merge.exe" exited with code 1.
|
|
|
|
|
Hello friends.. I am using datalist inside a datalist.
the problem is how to get datakey of the inner datalist for which the button is pressed....
|
|
|
|
|
Check the prperties of outer datalist it should container for innerdatalist then check the id for that control
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi
In my application i want to find ip address of the user machine
who is accessing my application.I am develop an application for
it but it gives me ip address of my server i.e the server on which
my application is running but i want to find out ip address of the
machine who is accessing my application.How can i do this using ASP.
Please guide me to solve this.
Thanks.
Rahul
|
|
|
|
|
Request.ServerVariables("REMOTE_ADDR")
or
Request.ServerVariables("REMOTE_HOST")
should both give this.
|
|
|
|
|
Hi Fred_Smith
i already tried this.If i am running application from localhost
then is shows me default ip address 127.0.0.1.if i am runnign
application using my system name like http://mysysname//add.asp then it
shows me correct ip address. If i am upload the application on my
server then it shows me server ip address but i need user machine access
not server host ip address on which application is running. if i am
running same applcation from different machine it shows me same address
as before.if i am accessing application from different machine then it
should show me different ip address not same.Plese tell me how to do
that.
Thanks.
Rahul
|
|
|
|
|
OK.. try using:
Dim ip as string = Request.UserHostAddress
|
|
|
|
|
HI
I tried this it gives me following error.
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'UserHostAddress'
Rahul
|
|
|
|
|
Well this is an ASP.NET forum, not VBScript... I suggest you try Googling "client ip address vbscript" and follow up some of the results...
|
|
|
|
|
I know this is asp.net forum i have implemented same application using asp.net also when i run the application on local machine it gives me correct ip address
and when i am upload this to server and run the page then it also show me
server ip address and server name insted my machine name.
Ok thanx for u r help.
Rahul
|
|
|
|
|
Ths may help: (you'll ned to convert ot VB)
string ip;
ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR");
if(ip==string.Empty)
{
ip=Request.ServerVariables("REMOTE_ADDR");
}
REMOTE_ADDR does not always provide the users IP but rather the ISPs' IP address so first test HTTP_X_FORWARDED_FOR as this one is the real user IP.
|
|
|
|
|
Thanx
I tried that but the result is same as before.Is there
any server setting required for that purpose.
Thanks.
Rahul
|
|
|
|
|
Try this code:
Request.ServerVariables["REMOTE_ADDR"].ToString();
SSK.
|
|
|
|
|
Hi Vri SSK
i already tried this.If i am running application from localhost
then is shows me default ip address 127.0.0.1.if i am runnign
application using my system name like http://mysysname//add.asp then it
shows me correct ip address. If i am upload the application on my
server then it shows me server ip address but i need user machine access
not server host ip address on which application is running. if i am
running same applcation from different machine it shows me same address
as before.if i am accessing application from different machine then it
should show me different ip address not same.Plese tell me how to do
that.
Thanks.
Rahul
|
|
|
|
|
HttpContext.Current.Request.UserHostAddress
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
HI
i tried this it gives me my server ip address not my machine ip address.
again any solution.
Thanks.
Rahul
|
|
|
|
|
In our web applications this works just fine. Seams that the problem is something different.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Could you please elaborate Where you have hosted your web application. Its localhost or outside ur network??
|
|
|
|
|
The web application was hosted on a dedicated server that was accessible locally, or from intranet or over internet. the IP could always be requested in the way I explained some post earlier.
However, this was a long time ago, on a different .NET version that today's.
Hope that helps...
-^-^-^-^-^-^-^-
planetgeek.ch
|
|
|
|
|
Dear Friends..
I am having an .aspx page in which i have various HTML controls such as text boxes and buttons("OK" and "CLEAR" buttons).By default, when i press the "ENTER" key in my keyboard ,the "OK" button must get fired...But its not getting fired..I need to use the tab button to make that "OK" button get fired..How to make the "OK" button get fired without using the TAB key..? "
I use javacript for validation..Is there anything do with javascript in this regard..?
Regards,
Balaguru
|
|
|
|