|
Does anybody have experiences with Fragment cache? I have some trouble here...
Basically, I have 3 dropdownlists, ddlAccountGroupType, ddlGroupName and ddlAccountID in a user control. The reason I use cache varybycontrol because ddlAccountID could contain over 8000 accounts. Once the selected index is changed in ddlAccountID, it will raise event handler to trigger the parent page to retrieve Order list and allow user to edit the order details. So, I have <%@OutputCache duration="600" varybycontrol="ddlAccountGroupType;ddlGroupName;ddlAccountID" %> on my .ascx file.
The problem is , sometimes, when parent page do a postback, the second dropdownlist ddlGroupname become empty when it was supposed to have one single item "--ALL--". I couldn't figure out why it happens. I read about some discussion said, under memory pressure, the cached data could be removed before it reaches its expire date. Did anyone have similiar issue? I know you can set programmatic cache NotRemovable. Is there a way to set fragement cache NotRemovable?
By the way, I read something about Cache does not work with Web Farms. Although my problem happens on my local development server, but my production server does use web farm. Do anyone have any thoughts or suggestions about this?
Any help would be very appreciated!
Thanks in advance!
|
|
|
|
|
any suggestion would be appreciated!
|
|
|
|
|
Hi,
I have a solution which consists of three projects: a web app, a command line app and a dll containing some code to access a web service. The DLL is confusing me because there seems to be two references to my web service:
1. There's an actual "Web Reference" with "URL Behavior" set to "Dynamic". This seems to get used by the web app when it accesses the DLL.
2. There's also an app.config file which contains a "Properties.Settings" value for the web service's URL and this seems to relate to a "Settings.settings" file in the app's project under the "Properties" folder. This setting seems to get used by the command line app when it accesses the DLL.
If I want to change the web service's URL, I'd like to be able to just change the app.config if possible. Is that possible? Do I need the web reference as well? I think I do because otherwise I don't have a namespace I can use.
How do I have just one reference to the web service in my DLL?
Thanks
|
|
|
|
|
You can't make it totally central to one location. You have to have the Web Reference mostly for the IDE. You can make all references to it in your code look at one place that way you change it there, and the Web Reference.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
It looks like then, that I have to rebuild my apps if I want to move the web service they refer to
|
|
|
|
|
Hi all,
An error occurs when i use SqlConnection object to connect to Sql Server
Here is the stack trace:
at LoadLibraryW(UInt16* )
at System.EnterpriseServices.Thunk.Security.Init()
at System.EnterpriseServices.Thunk.Security.SuspendImpersonation()
at System.EnterpriseServices.Platform.Initialize()
at System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate cb) at System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl)\n at System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl ctrl, IntPtr SID)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
I actual can't understand and don't know how to resolve the problem
Thanks
|
|
|
|
|
Have a look at this link[^]
From MSDN
The problem was generated by Kaspersky Antivirus 6.0.2.621; even if it was disabled or closed, the exception still occured.
Now I'm using Kaspersky Antivirus 6.0.1.411 and all works fine.
Weird, and someone actually found a solution to it.
|
|
|
|
|
Hi all,
I'm having problems trying to move a file from my IIS server to a unc share on the same domain. I know it all boils down to a permission issue (the bane of my existence). I'm running IIS 5.0 (in production) and 5.1 (in test). I have impersonate set to true in web.config. Most everything else is pretty much default including the ASPNET account running the worker process. I know I have read/write permission in the share. I've even gone as far as to slip an WindowsImpersonationContext around the move code only to get the same Access denied error. I found this article[^] about Kerberos delegation which sounds like it could work but I wouldn't be able to give delegation rights to. Do I need to run the worker process under a domain account instead of the local ASPNET account? Has anybody else have this kind of issue?
Keith
|
|
|
|
|
Ok, so the moral of this story, use a domain account to run your asp.net process when you need to access network resources on the same domain. Well, that's the moral I used anyway. If anybody has other solutions to this, I'd like to hear them too. Here's an article for asp.net 1.1 which I took bits and pieces of to get the solution working http://msdn2.microsoft.com/en-us/library/aa302396.aspx[^]
Keith
|
|
|
|
|
hai dears,
i got an error while running from web deployment project,
that "cannot create activeX component" for excel.application..
But the same works perfectly while running from the code..
do have any solution ?
dhanis
|
|
|
|
|
Hi,
I have a web reference in my code that allows me to access a web service. I want to make sure that I'm accessing the right web service by checking the URL that's stored under the web reference.
For example if I'm accessing the web service from server X rather than server Y, I can just refer to the URL but can I get hold of this value somehow?
Thanks
|
|
|
|
|
|
|
Hi,
I'm trying to construct a datagrid dynamicly by reading properties from an Xml File.
so i've defined a template column so they fit the type of controls defined in the xml.
this is code wish define the template column
public class GenericItem : ITemplate
{
private readonly string column;
//private bool validate;
public GenericItem(string column)
{
this.column = column;
}
public void InstantiateIn(Control container)
{
Literal l = new Literal();
l.DataBinding += new EventHandler(this.BindData);
container.Controls.Add(l);
}
public void BindData(object sender, EventArgs e)
{
Literal l = (Literal)sender;
DataGridItem container = (DataGridItem)l.NamingContainer;
l.Text = ((DataRowView)container.DataItem)[column].ToString();
}
}
public class ValidateEditItem : ITemplate
{
private readonly string column;
public ValidateEditItem(string column)
{
this.column = column;
}
public void InstantiateIn(Control container)
{
TextBox tb = new TextBox();
tb.DataBinding += new EventHandler(this.BindData);
container.Controls.Add(tb);
tb.ID = column;
RequiredFieldValidator rfv = new RequiredFieldValidator();
rfv.Text = "please write!";
rfv.ControlToValidate = tb.ID;
rfv.Display = ValidatorDisplay.Dynamic;
rfv.ID = "validate" + tb.ID;
container.Controls.Add(rfv);
}
public void BindData(object sender, EventArgs e)
{
TextBox tb = (TextBox)sender;
DataGridItem container = (DataGridItem)tb.NamingContainer;
tb.Text = ((DataRowView)container.DataItem)[column].ToString();
}
}
public TemplateColumn DynamicColumns(string column, bool isEditable)
{
TemplateColumn genericcolumn = new TemplateColumn();
genericcolumn.HeaderText = column;
genericcolumn.ItemTemplate = new GenericItem(column);
if (isEditable)
{
genericcolumn.EditItemTemplate = new ValidateEditItem(column);
}
return genericcolumn;
}
and the way i contruct column is
if (Type != null)
{
//case of primary key
BoundColumn ColPk = new BoundColumn();
ColPk.DataField = c.ColumnName;
ColPk.SortExpression = c.ColumnName;
ColPk.ReadOnly = true;
Grid.Columns.Add(ColPk);
}else
{
//case of other column
TemplateColumn col;
col = DynamicColumns(c.ColumnName, true);
col.SortExpression = c.ColumnName;
Grid.Columns.Add(col);
}
so that I'm sure to make the primary Key not editable;
but the problem is how to retreive the primary key from datagrid
while it's in readOnly and I've want the value of this key to make Update
I've tried with two method
public void GridUpdate(Object sender, DataGridCommandEventArgs e)
{
//the first way
e.Item.FindControl("key").Text ;->it returns null ;
//the second way
grid.DataKeys[e.Item.ItemIndex];->the grid.Datakeys isempty
}
So I can't contruct the UpdateQuery
thank in advance for help
|
|
|
|
|
I do initialize some controls on Page_Load.
Sub Page_Load(ByVal Sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
SQLconn.Open()
Dim SelectCmd1 As New SqlCommand("SP1", SQLconn)
SelectCmd1.CommandType = CommandType.StoredProcedure
Dim result1 As Integer
Dim myDataReader1 As SqlDataReader
myDataReader1 = SelectCmd1.ExecuteReader()
myDataReader1.Read()
result1 = myDataReader1.GetInt32(0)
SQLconn.Close()
ChangeButton(result1)
End Sub
Sub ChangeButton(ByVal Status As Integer)
If Status = -1 Then
Label1.Text = "ON"
OnOff1.Style.Value = "background-image: url(../ImgContr/1.png);"
Else
Label1.Text = "OFF"
OnOff1.Style.Value = "background-image: url(../ImgContr/2.png);"
End If
End Sub
I moved the code from Page_Load to MyRefresh bc I want to call this code fom other events too:
Sub Page_Load()
If Not Page.IsPostBack Then
MyRefresh()
End If
End Sub
Sub MyRefresh()
SQLconn.Open()
Dim SelectCmd1 As New SqlCommand("SP1", SQLconn)
SelectCmd1.CommandType = CommandType.StoredProcedure
Dim result1 As Integer
Dim myDataReader1 As SqlDataReader
myDataReader1 = SelectCmd1.ExecuteReader()
myDataReader1.Read()
result1 = myDataReader1.GetInt32(0)
SQLconn.Close()
ChangeButton(result1)
End Sub
I don't get any errors but the controls get no values from the database. Something is missing but I don't know what.
Thanks
-- modified at 10:05 Friday 15th June, 2007
|
|
|
|
|
Have you tried debuging the code? What is the value that you are passing into the changebutton method? when you call the stored procedure manually do you get what you are expecting?
I would guess that your call to the stored procedure is not returning what you are expecting. Try debugging the code and see if that helps you figure it out.
Ben
|
|
|
|
|
I'm absolutely sure that the SP is correct bc when I have the content of the content of MyRefresh() in the Page_Load it works without any problems.
But when I moved the code to MyRefresh() and call it from Page_Load it doesn't work
Sub Page_Load()
If Not Page.IsPostBack Then
Refresh()
End If
End Sub
|
|
|
|
|
Well, based on the code you posted the only difference I can see is in the new code you are checking If Not Page.IsPostback
This seems like the correct thing to do, but it doesn't seem you did that when you weren't using the MyRefresh() method. So I guess you could try removing that and see if it works. I still think you should be able to step through the program and see if the code is getting called correctly.
Ben
|
|
|
|
|
If Not Page.IsPostback has no effect...but I think I found something.
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
SQLconn.Open()
Dim SelectCmd1 As New SqlCommand("SP1", SQLconn)
SelectCmd1.CommandType = CommandType.StoredProcedure
Dim result1 As Integer
Dim myDataReader1 As SqlDataReader
myDataReader1 = SelectCmd1.ExecuteReader()
myDataReader1.Read()
result1 = myDataReader1.GetInt32(0)
SQLconn.Close()
ChangeButton1(result1)
End Sub
"Handles MyBase.Load" is the key....when I remove this I have the same as in the MyRefresh().
I had to modified it like this:
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Refresh()
End If
End Sub
Sub Refresh()
SQLconn.Open()
Dim SelectCmd1 As New SqlCommand("SP1", SQLconn)
SelectCmd1.CommandType = CommandType.StoredProcedure
Dim result1 As Integer
Dim myDataReader1 As SqlDataReader
myDataReader1 = SelectCmd1.ExecuteReader()
myDataReader1.Read()
result1 = myDataReader1.GetInt32(0)
SQLconn.Close()
ChangeButton1(result1)
End Sub
Why is Handles MyBase.Load so important???
|
|
|
|
|
Without it your load event doesn't fire. That is how your code behind methods get linked into events. Glad you figured it out.
Ben
|
|
|
|
|
Thank you..
but I haven't finished yet..
|
|
|
|
|
Hi,
This has got me really baffled. When I run Dim url As String = HttpContext.Current.Request.Url.AbsolutePath.ToLower from Application_beginRequest in Global.asax with server that ships with Visual Web Developer everything works as expected.
However, today when I tried to move all code onto IIS server this just doesn't return the same URL!
On localhost (Visual Web Developer), variable url is /sandbox/my/home/page, but on IIS it returns /sandbox/index.aspx.
Yes, this is another HttpContext.RewritePath application which is why I need to know what the user types as a URL event though a 404 error is expected.
Anyone have any idea why the url would be different, or know of anything I could possibly be doing wrong?
Any help is greatly appreciated.
Thanks,
Jason.
|
|
|
|
|
This is just a guess, but with VS you are telling it what page to start on. With IIS when you enter the url it uses your IIS settings to figure out what the default page should be. index.aspx sounds like the default page you set up in IIS. So if you want a call to the basic url to go to a different default page you need to change it in IIS manager.
Hope that helps.
Ben
|
|
|
|
|
Ben,
Thank you for the prompt reply. I have enabled the default content page in IIS and it's pointing to index.aspx. I do want the default page to be index.aspx.
The thing is, I've designed user friendly urls but they won't work because IIS is trying to go directly to them but they are virtual, so they don't exist. I'm using HttpContext.RewritePath to rewrite the urls.
Jason.
|
|
|
|
|
So if the user types in the base url with no page, it will go to your default page. So what is your problem? I have done much RewritePath stuff, but I have done some http handler stuff. Are you sure your handler is set up correctly so that it is getting called?
Ben
|
|
|
|