|
hi how r u ?
am using forms authentication i think i made everything required
authentication mode="Forms"
<forms name=".aspxauth" loginurl="login.aspx">
void LoginBtn_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{ String EmpNo=Get_EmpNo_Login();
// a function that gets EmpNo and sets the login_err textfield (if autherized = "allowed")
if(Login_err.Text=="allowed")
{
if(EmpNo!="-100")//not autherized, just to make sure.
Response.Redirect("HomePage.aspx");
}
}
}
will i cant redirect the user to HomePage or anywhere it keeps redirecting to the login.aspx
am i missing sth?????
thx
-- modified at 16:47 Monday 8th May, 2006
|
|
|
|
|
You have forgotten callinh the Authenticate() method.
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
Can someone explain to me the correlation between the COM threading model of a web service consumer and the web service if that web service is not using COM components?
I have a simple test web service generated straight out of the VS 2003 web service wizard. It has a single WebMethod that consists entirely of a Thread.Sleep(500); call. I created a simple console app that will attempt to call the web service method 10 times. It will do so either on the main thread or on a new separate thread based on user input. The Main method of the tester is marked [STAThread]. If I call the web service method on the main thread there is no problem. If I then call it on a separate thread, the invocation freezes in the web service proxy and never gets into the web service. If I then call the web service from the main thread, the main thread works and the frozen thread unfreezes and the two sets of calls are interspersed. If I quit the application and run again, this time calling the web service on the separate thread first, the web service is called correctly. I can then call the web service on the main thread or another new thread no problem. If I change the designation of Main to [MTAThread], I can now run in any order I want.
Is there some COM thing going on am unaware of in the web service invocation? Or is this freezing problem unrelated to COM but then why does the COM threading model change have an effect.
Thanks for any help
|
|
|
|
|
When a user scrolls to the bottom of the page and clicks a button a similar page is displayed. When this second pages displays I would like it to automatically scroll down to the bottom as was the first page. Can this be done?
|
|
|
|
|
You can achive this with anchors.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I setup anchor tags to link to the other pages and link to those pages using the following code:
response.redirect("bottletype.aspx#target")
It works good for all but one of the pages. On that page it does not display the entire string in the browser. Instead of
http://localhost:1340/CollingwoodWater/bottletype.aspx#target
it shows
http://localhost:1340/CollingwoodWater/bottletype.aspx
So it does not anchor. Why doesn't display "#target" as part of the address?
|
|
|
|
|
if using IE try
SmartNavigation = true;
|
|
|
|
|
hi dptalt,
You can write "SmartNavigation=True" in @Page directive of a page if using IE.
you can also try for "MaintainScrollPositionOnPostBack=true".
Best of luck.
Tirtha
Tirthadip
|
|
|
|
|
Use SmartNavigation in ASp.net
But it will work only in IE
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Hello,
I first created a class called BreadCrumbs.cs. Here is a snippet of code...
***Portion of BreadCrumbs.cs code***
namespace Sabre_Solutions
{
///
/// Summary description for BreadCrumbs.
///
public class ctrlBreadCrumbs:System.Web.UI.WebControls.WebControl
{
public string Separator = ">";
public string RootName = "Home Page";
public char directoryNameSpacer = '_';
private string _PageTitle;
public string PageTitle
{
get
{
***and so on...****
Okay, second part. Created my own control called BreadCrumbs.ascx. This is its code (in entirety)
***code for BreadCrumbs.ascx
<%@ Register TagPrefix = "bc" Namespace = "Sabre_Solutions" Assembly = "BreadCrumbs"%>
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="BreadCrumbs.ascx.cs" Inherits="Sabre_Solutions.BreadCrumbs" %>
****End .asxc***
Part three, the code behind..
****BreadCrumbs.asc.cs*******
namespace Sabre_Solutions
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Text;
///
/// Summary description for BreadCrumbs.
///
public class BreadCrumbs : System.Web.UI.UserControl
{
protected ctrlBreadCrumbs bc1;
private string _strHeaderText;
public string HeaderText
{
get
{
return _strHeaderText;
}
set
{
_strHeaderText = value;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
bc1.PageTitle = HeaderText;
}
***and so on...***
So the question. Everything compiles correctly, but when I drop the control into an .aspx file and try to run I get this error:
The base class includes the field 'bc1', but its type (Sabre_Solutions.ctrlBreadCrumbs) is not compatible with the type of control (Sabre_Solutions.ctrlBreadCrumbs).
I've been searching online and it seems to be a common problem, but none of the answers were on point (for me anyhow). I've tried changing a number of things but with no luck. I'm sure it's something small...can anyone see it?
-- modified at 14:35 Monday 8th May, 2006
|
|
|
|
|
***Portion of BreadCrumbs.cs code***
namespace Sabre_Solutions
{
///
/// Summary description for BreadCrumbs.
///
public class ctrlBreadCrumbs:System.Web.UI.WebControls.WebControl
{
public string Separator = ">";
public string RootName = "Home Page";
public char directoryNameSpacer = '_';
private string _PageTitle;
public string PageTitle
{
get
{
***and so on...****
Okay, second part. Created my own control called BreadCrumbs.ascx. This is its code (in entirety)
***code for BreadCrumbs.ascx
<%@ Register TagPrefix = "bc" Namespace = "Sabre_Solutions" Assembly = "BreadCrumbs"%>
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="BreadCrumbs.ascx.cs" Inherits="Sabre_Solutions.BreadCrumbs" %>
****End .asxc***
Part three, the code behind..
****BreadCrumbs.asc.cs*******
namespace Sabre_Solutions
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Text;
///
/// Summary description for BreadCrumbs.
///
public class BreadCrumbs : System.Web.UI.UserControl
{
protected ctrlBreadCrumbs bc1;
private string _strHeaderText;
public string HeaderText
{
get
{
return _strHeaderText;
}
set
{
_strHeaderText = value;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
bc1.PageTitle = HeaderText;
}
***and so on...***
It seems to me that your base class should inherit usercontrol not web control. Then your usercontrol codefile should inhert the base class.
Like this
//Base class
public class ctrlBreadCrumbs:System.Web.UI.UserControl
{
}
//User Control
public class BreadCrumbs : ctrlBreadCrumbs
{
}
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
ToddHileHoffer wrote: It seems to me that your base class should inherit usercontrol not web control. Then your usercontrol codefile should inhert the base class.
Like this
//Base class
public class ctrlBreadCrumbs:System.Web.UI.UserControl
{
}
//User Control
public class BreadCrumbs : ctrlBreadCrumbs
{
}
Okay, made those changes. So my snippets look like this...
***BreadCrumbs.cs***
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Text;
using System.Web;
namespace Sabre_Solutions
{
///
/// Summary description for BreadCrumbs.
///
public class ctrlBreadCrumbs:System.Web.UI.UserControl
{
public string Separator = ">";
public string RootName = "Home Page";
public char directoryNameSpacer = '_';
private string _PageTitle;
public string PageTitle
{
get
***and so on***
***Breadcrumbs.ascx***
<%@ Register TagPrefix = "bc" Namespace = "Sabre_Solutions" Assembly = "BreadCrumbs"%>
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="BreadCrumbs.ascx.cs" Inherits="Sabre_Solutions.BreadCrumbs" %>
<bc:ctrlbreadcrumbs id="bc1" runat="server">
***END***
***BreadCrumbs.ascx.cs***
namespace Sabre_Solutions
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Text;
///
/// Summary description for BreadCrumbs.
///
public class BreadCrumbs : ctrlBreadCrumbs
{
protected BreadCrumbs bc1;
private string _strHeaderText;
public string HeaderText
{
get
{
return _strHeaderText;
}
set
***and so one****
Now, when I compile I get the following error:
c:\inetpub\wwwroot\Sabre Solutions\BreadCrumbs.ascx.cs(16): 'Sabre_Solutions.ctrlBreadCrumbs' is defined in multiple places; using definition from 'c:\inetpub\wwwroot\Sabre Solutions\BreadCrumbs.cs' (I bolded the line it's referencing.)
Just for giggles I tried to run just the .aspx form that has the control. I still get the error but it's slightly different...
The base class includes the field 'bc1', but its type (Sabre_Solutions.BreadCrumbs) is not compatible with the type of control (Sabre_Solutions.ctrlBreadCrumbs
Any other ideas? My brain is fried at this point.
|
|
|
|
|
How to connect Active Directory using LDAP? The code should work in ASP and ASP.Net.
Thanks for your help.
|
|
|
|
|
public bool AuthenticateUser(string domain, string username, string password)
{ string LDAPPATH ="LDAP://appserver.com";
string domainAndUsername = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry( "LDAP://appServer.com", domainAndUsername, password);
try
{
// Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
search.PropertiesToLoad.Add("cn");
SearchResultCollection result = search.FindAll();
if( result.Count==0)
{
return false;
}
}
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
-- modified at 4:42 Tuesday 9th May, 2006
|
|
|
|
|
Hi Himabindu,
Thank you for your code, but what I need is the code should work in both ASP and ASP.Net. Without using directory services it should work in both.
for ex. in ASP
strADsPath = "LDAP://strservername/DC=xxx,DC=com"
Set objldap = GetObject(strObjectADsPath)
objldap.GetInfo
above code will work in ASP but how to execute same code in asp.net
|
|
|
|
|
I get this error: "Invalid attempt to FieldCount when reader is closed." on the databind() method when the following code is run:
Private Sub loadProject()
Dim objDR As SqlDataReader
Dim objConn As New SqlConnection(strConn)
Dim objSQL As New SqlCommand("SELECT * FROM Projects ORDER BY Priority DESC, ProjectID DESC", objConn)
objConn.Open()
objDR = objSQL.ExecuteReader
grdDisplay.DataSource = objDR
grdDisplay.DataBind() <--Error occurs here
If grdDisplay.Items.Count = 0 Then
grdDisplay.Visible = False
lblMessage.Text = "No projects found."
Else
grdDisplay.Visible = True
End If
objDR.Close()
objConn.Close()
End Sub
This code is called directly from the Page_Load event on the first page after login so there are no prior database calls that could close the connection. When I step through the code in VS the autos window shows the objDR IsClosed property is FALSE at the time the databind() method is called.
This same code (different SQL strings) works fine everywhere else in the app. Also it has been working fine all along and just simply stopped working. The only change I made was moving the database and thus adjusting the connection string (which works fine elsewhere.
What am I missing?
Thank you in advance for any suggestions!
Peter
-- modified at 14:37 Monday 8th May, 2006
|
|
|
|
|
Try this.
Private Sub loadProject()
Dim objDR As SqlDataReader
Dim objConn As New SqlConnection(strConn)
Dim objSQL As New SqlCommand("SELECT * FROM Projects ORDER BY Priority DESC, ProjectID DESC", objConn)
objConn.Open()
objDR = objSQL.ExecuteReader
grdDisplay.DataSource = objDR
grdDisplay.DataBind() <--Error occurs here
objDR.Close()
objConn.Close()
If grdDisplay.Items.Count = 0 Then
grdDisplay.Visible = False
lblMessage.Text = "No projects found."
Else
grdDisplay.Visible = True
End If
End Sub
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thanks for the suggestion - however I still get the same error. This error occurs on both my development laptop, and on my internal test server.
|
|
|
|
|
How is your grid set up? I bet you are attempting to bind to columnName not returned in your query. Remember the fieldnames are case sensitve. Also, try not using * but rather listing the fields.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thanks! You forced me to review the datagrid setup and of course I realized that I have an embedded datagrid that lists project tasks, and of course it was throwing the error, not the parent datagrid().
Sometimes you cant see the forest through the trees.
|
|
|
|
|
I use MS Studio to coding the asp.net, i need to perform some action if the user close the web page, i try page_unload before but cannot function. So, may i know where i should put my code for the coding page, when the user close the page and some action fired?
|
|
|
|
|
The page unload is the event on the code behind not the client. You can't really run server code when the browser closes. You can however, run code in the global.asax for the Session_End event.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Well you can call some server-side code using AJAX in the onBeforeUnLoad
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
This is a difficult one. You can add a javascript function to the body (onunload). The only problem you have is that this function will fire before postback as well. You will have to pull some trick of setting a javascript variable that controls the function.
You won't be able to do server side processing, because the page will not do a request when you close it. Well I think so. If that is wrong, can someone please correct me.
TMF
|
|
|
|
|
Use Window.unload Event of the Javascript
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|