|
Hi all,
One Page of my ASP.NET application uses an active directory search to fetch the list of users.
The Problem is :
This page works fine all day long but sometimes throws an error "The server is not operational".
This error disappears when the IIS is reset, but appears again after 2 or 3 hrs.I am unable to find out the reason behind this.I am sending you the details I found in the event Viewer:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 4/15/2009 6:23:17 AM
Event time (UTC): 4/15/2009 1:23:17 PM
Event ID: dbd99a355e4f451da4fd7e4f50e0f8e1
Event sequence: 21
Event occurrence: 6
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/399023246/Root/Mail-14-128842748654050392
Trust level: Full
Application Virtual Path: /Mail
Application Path: C:\Inetpub\wwwroot\EnhancementSite\Mail on myip\
Machine name: mymachinename
Process information:
Process ID: 2380
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: COMException
Exception message: The server is not operational.
Request information:
Request URL: http://mydomain.com/Mail/newmail.aspx
Request path: /Mail/newmail.aspx
User host address: mydomain.com
User: username
Is authenticated: True
Authentication Type: NTLM
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 5
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll()
at GetAllUsers.getUsers.getUsername(DropDownList dduserlist)
at Mail.newmail.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
kindly help me find a permanent solution to this problem as iisreset is not a very good option.
Thanks
Vasillis_zayetsav
|
|
|
|
|
Try this...
Replace the values for user and active directory group.
DirectoryEntry ent = new DirectoryEntry(appSettings.domain, appSettings.user, appSettings.password, AuthenticationTypes.ReadonlyServer);
DirectorySearcher srch = new DirectorySearcher(ent, "(CN=" + activeDirectoryGroup + ")");
SearchResult obj = srch.FindOne();
DirectoryEntry dr = new DirectoryEntry(obj.Path, appSettings.user, appSettings.password);
foreach (object ob in (IEnumerable)dr.Invoke("members"))
{
DirectoryEntry obGpEntry = new DirectoryEntry(ob);
//Put your code here.
}
I didn't get any requirements for the signature
|
|
|
|
|
Any thoughts how to prevent displaying querystring value information...e.g. abc.aspx?userid=103?
If someone wants they can type in userid=101 or 102 to display information for the other records by typing in the URL. I've heard folks use GUIDs when passing ID's in URLS. When you see a large value of 889EA536-0B32-3345-B124-F44141C50CB7 would make it complicated to guess the next record. My guess they'd use an INT as the PK, but meanwhile have a GUID column for each user record? Thoughts on that practice?
Thanks
|
|
|
|
|
|
Ya encryption is a good way but its been restricted to 2mb in IE and again it depends on the browser you are using.
|
|
|
|
|
If you don't want people to see your querystring, then save it to database and use some ID, preferably GUID. Then based on the id you read the querystring value.
another technique is to host your application in iframe, that way only the top level url which houses the iframe will be visible and the user can not see the full url + querystring.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Since you are dealing with only an integer, you could store it in the Session on the source page and then do a response.redirect to the new page and read the session value.
SourcePage:
Protected Sub TransferButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TransferButton.Click
Session("MyId") = MyID
Response.Redirect("TargetPage.aspx")
End Sub
TargetPage.aspx:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim MyID as Int = 0
If Me.IsPostBack = False then
MyID = CInt(Session("MyId"))
Session("MyId") = Nothing 'Clear value from session after retrieving
End If
End Sub
- Robert Beaubien
- Kool Software LLC
- Try the New Warp10 Code Generator and Framework at https://www.warp-10.com
-
|
|
|
|
|
you have many options:
1. Not use query string, use post method and retrieve value on next form using previouspage object
2. Use encrypted values in querystring, there are hundreds of different algorithms
3. Use Session object
4. Use Profile
5. Use Application Object too.
6. Use Encrypted Cookies
7. If you want to slow down a little bit use database
8. Also you can use file handling to write value to text or xml file
From
Gaurav Mahajan
Website Developer Amritsar
Website: sushilindia.com
|
|
|
|
|
I'll sugest using session objects, it's the easiest way.
oh and if you didn't know , you can place any type of object into a session variable you'll just have to convert it back to the type of object you want when you use it, and another plus , its value can be used on any page.
|
|
|
|
|
"oh and if you didn't know , you can place any type of object into a session variable you'll just have to convert it back to the type of object you want when you use it, and another plus , its value can be used on any page."
True, but large objects will require more memory in the webserver and will limit scalability of the website.
- Robert Beaubien
- Kool Software LLC
- Try the New Warp10 Code Generator and Framework at https://www.warp-10.com
-
|
|
|
|
|
Here is my scenario... a user control (UCCulture) with a dropdown box for culture. Autopostback on change of dropdown box sets the thread culture to new value early in page lifecyle.
In most cases, a post back does not require rebinding data, however, in the case of a culture change, this often does require a rebinding of data using the newly selected culture.
I'm looking for the best way to allow UCCulture to fire a CultureChanged event and have the page, masterpage and all other user controls subscribe to this event, so they can rebind their data, if necessary, when the event is fired.
I have base classes for Page and UserControl, and would prefer to wire up the events in these base classes instead of manually writing the event hookup code individually.
Anyone developed a pattern for this type of thing already?
|
|
|
|
|
Hi,
I'm hoping you guys can help me with a question.
I've been reviewing someone else's code, and I found that in some places where they are using a repeater to display data from a database, in places where the Database query will only ever return 1 row of data. They are returning a reader, loading a datatable with the reader data, and binding that datatable to a repeater.
now am I nutz, or is that extremely inefficient?
it's always been my practice to take the reader, check for rows, and then set individual controls (like literals) to the fields directly.
the only reason I can think of to do this, is that if for some reason there isn't any data, the repeater won't display anything. however I've always handled this by wrapping the results in a div, and setting the div's visibility property to false if there is no data returned.
please let me know your opinion.
thank you
|
|
|
|
|
There are better ways of the doing that, but it probably doesn't matter.
As you say you can always count the rows in the data table. If no rows exists display another div.
If this application is going to have 10K+ users then you might want to look at doing this in a more efficient way. But really it is probably fine. However, you really should not use a repeater if you are only going to have one record. That's just common sense, it is called a repeater for a reason.
Also, why use a datareader to get a datatable. This is foolish. Use the dataAdapter to get a dataTable. Use DataReader to iterate through read only data or bind a control directly to a datareader object.
I didn't get any requirements for the signature
|
|
|
|
|
Thanks Todd
you mentioned a better way?
do you mean a better way than binding the reader data to literals?
if so, would you mind giving more details?
This particular page get's 4-5k views daily, and will see more as the application gets expanded, and marketed more, so I will be re-writing this page at least.
I have no idea why they are retrieving the data like that, my guess is the person who wrote it didn't know any other way of binding data than by using a datatable.
I have a feeling I'm going to find lots more WTF's when I get the final codeset and can look at everything together.
|
|
|
|
|
icewolf_snowfire wrote: do you mean a better way than binding the reader data to literals?
if so, would you mind giving more details?
Yes I did. It depends on your individual situation, but if you are only viewing one record I wouldn't use any databinding. Just put the controls you need inside a div tag. Write an init method to load the data (obviously only during the initial load and not postbacks).
If the data is constantly changing then use a dataReader or output parameters in a stored procedure. If the data is rather static then cache the data. I wrote a sample article about how to do that here[^]
Also, check this out http://msdn.microsoft.com/en-us/library/ms998549.aspx[^]
I didn't get any requirements for the signature
|
|
|
|
|
How to share a session between 2 soap clients?
The soap clients are generated by VS2008 in a VB.Net Windows Froms project by making a reference. The 2 clients make requests to the same "Project" but different "WebService" classes. I don't find a way to add a cookie container or sortlike to share the session.
Dim service1 As New ServiceReference1.Service1SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/TheWebService/Service1.asmx"))
Dim service2 As New ServiceReference2.Service2SoapClient(bhp, New ServiceModel.EndpointAddress("http://localhost/TheWebService/Service2.asmx"))
It feels good to learn and achieve
|
|
|
|
|
Is there anything useful for your in this CP article? Sharing Session Across Applications[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hy, thanks but i'm afraid it's not...
I guess the problem resides on the client side(SOAP Client) and not on the server.
I use a BasicHttpBinding class and need to set the property "AllowCookies" to true for the client to remember the session id.
Now when i want to share that session/cookie between 2 SOAP Clients, they call a different "WebService Class" in the same "WebService Project" (ASP.NET VS2008).
I still did not figure out how to do this, so i made a "work around"... Not so clean but now the PHB is happy...
I posted this problem earlier (VS2008 SOAP Client - losing Session problem[^]).
It feels good to learn and achieve
|
|
|
|
|
To be a little more specific, it is not a HttpApplication but a Windows Forms Application calling the web service. Maybe i better posted it in another message board. But because i am not sure the problem resides on the Client side, and it's includes ASP.NET, i posted it here.
It feels good to learn and achieve
|
|
|
|
|
Hi All,
I am trying to bind a GridView with an user defined object it is binding fine when I dont use AlloPaging="false" but is giving exception when I try to implement paging in it.
It is giving Datasource doesnt allow serverside paging.
Can anybody please advice me how can I achieve paging in GRidView when I bind it with an object.
Any code snippet or any links are verymuch usefull.
Thanks,
Md. Abdul Aleem.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Check this
Paging without a wizard (SqldataSource control) [^]
Hope it Helps
Vuyiswa Maseko
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
|
Let us See your Code and we will tell when you have gone wrong. Another thing you say you have set
AlloPaging="false"
that is not Correct its
AllowPaging="false"
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Ok spelling mistake but it is not the problem in the real code
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Do you still have a Problem ? if so please Post your Code. i see your work for NIIT, which Country ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|