Saturday, March 31, 2012
Straight ASP problem
I am having a weird problem. Currently I have a straight ASP page that
queries an Access database and returns the large recordset on a page that
loops through the recordset and writes the appropriate <td> tags in order to
put the data into a table. Now when I run it in my test environment it runs
no problem, however when I upload to my ISP I get a iis 500 error. But no
error on test server.
A few things: I have noticed that if I decrease the the number of
Response.Write and rstSearch.Fields("FIeldName") code lines that it works
ok on the ISP server.
Any ideas?
JoePart of the web configuration in IIS is the time allowed for a page to run.
If it goes beyond say 900 seconds IIS thinks it's hit an error and declares
a problem.
Another part of the configuration tells IIS what to do with errors; either
give an unhelpful 'an error occurred...' message or give full details to
help the developer figure out what went wrong. In a production environment
IIS is usually set to give no help to potential hackers.
It may simply be that having so many response.write lines in your page takes
too long to process. That would explain why removing some of them fixes the
problem.
Suggestions:
Increase the time-out period by alering the config on your IIS server.
Decrease the size of the recordset. Maybe use paging?
Brian Lowe
--@.
"Joe Coppola" <jocojr@.hotmail.com> wrote in message
news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
> Hi there.
> I am having a weird problem. Currently I have a straight ASP page that
> queries an Access database and returns the large recordset on a page that
> loops through the recordset and writes the appropriate <td> tags in order
to
> put the data into a table. Now when I run it in my test environment it
runs
> no problem, however when I upload to my ISP I get a iis 500 error. But no
> error on test server.
> A few things: I have noticed that if I decrease the the number of
> Response.Write and rstSearch.Fields("FIeldName") code lines that it works
> ok on the ISP server.
> Any ideas?
> Joe
>
Brian,
Thanks for the reply. I too thought about the timeout setting, but
interestingly I changed the timeout setting on my test server to be like 1
second and I dont get the error, the page just doesnt finish loading
completely. Note I also set the timeout or ASP pages as well.
Is there a way to get a more complete error message?
You are correct the # of response lines is sort of the cause, and I have
thought of paging the results, however, I need the users to be able to
export the whole results to another program... any ideas of this?
Well thanks for the help.
Joe
"Brian Lowe" <no@.reply.address> wrote in message
news:%23ZJsgHeUEHA.2580@.TK2MSFTNGP12.phx.gbl...
> Part of the web configuration in IIS is the time allowed for a page to
run.
> If it goes beyond say 900 seconds IIS thinks it's hit an error and
declares
> a problem.
> Another part of the configuration tells IIS what to do with errors; either
> give an unhelpful 'an error occurred...' message or give full details to
> help the developer figure out what went wrong. In a production environment
> IIS is usually set to give no help to potential hackers.
> It may simply be that having so many response.write lines in your page
takes
> too long to process. That would explain why removing some of them fixes
the
> problem.
> Suggestions:
> Increase the time-out period by alering the config on your IIS server.
> Decrease the size of the recordset. Maybe use paging?
> Brian Lowe
> --@.
> "Joe Coppola" <jocojr@.hotmail.com> wrote in message
> news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
that
order
> to
> runs
no
works
>
Straight ASP problem
I am having a weird problem. Currently I have a straight ASP page that
queries an Access database and returns the large recordset on a page that
loops through the recordset and writes the appropriate <td> tags in order to
put the data into a table. Now when I run it in my test environment it runs
no problem, however when I upload to my ISP I get a iis 500 error. But no
error on test server.
A few things: I have noticed that if I decrease the the number of
Response.Write and rstSearch.Fields("FIeldName") code lines that it works
ok on the ISP server.
Any ideas?
JoePart of the web configuration in IIS is the time allowed for a page to run.
If it goes beyond say 900 seconds IIS thinks it's hit an error and declares
a problem.
Another part of the configuration tells IIS what to do with errors; either
give an unhelpful 'an error occurred...' message or give full details to
help the developer figure out what went wrong. In a production environment
IIS is usually set to give no help to potential hackers.
It may simply be that having so many response.write lines in your page takes
too long to process. That would explain why removing some of them fixes the
problem.
Suggestions:
Increase the time-out period by alering the config on your IIS server.
Decrease the size of the recordset. Maybe use paging?
Brian Lowe
---@.
"Joe Coppola" <jocojr@.hotmail.com> wrote in message
news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
> Hi there.
> I am having a weird problem. Currently I have a straight ASP page that
> queries an Access database and returns the large recordset on a page that
> loops through the recordset and writes the appropriate <td> tags in order
to
> put the data into a table. Now when I run it in my test environment it
runs
> no problem, however when I upload to my ISP I get a iis 500 error. But no
> error on test server.
> A few things: I have noticed that if I decrease the the number of
> Response.Write and rstSearch.Fields("FIeldName") code lines that it works
> ok on the ISP server.
> Any ideas?
> Joe
Brian,
Thanks for the reply. I too thought about the timeout setting, but
interestingly I changed the timeout setting on my test server to be like 1
second and I dont get the error, the page just doesnt finish loading
completely. Note I also set the timeout or ASP pages as well.
Is there a way to get a more complete error message?
You are correct the # of response lines is sort of the cause, and I have
thought of paging the results, however, I need the users to be able to
export the whole results to another program... any ideas of this?
Well thanks for the help.
Joe
"Brian Lowe" <no@.reply.address> wrote in message
news:%23ZJsgHeUEHA.2580@.TK2MSFTNGP12.phx.gbl...
> Part of the web configuration in IIS is the time allowed for a page to
run.
> If it goes beyond say 900 seconds IIS thinks it's hit an error and
declares
> a problem.
> Another part of the configuration tells IIS what to do with errors; either
> give an unhelpful 'an error occurred...' message or give full details to
> help the developer figure out what went wrong. In a production environment
> IIS is usually set to give no help to potential hackers.
> It may simply be that having so many response.write lines in your page
takes
> too long to process. That would explain why removing some of them fixes
the
> problem.
> Suggestions:
> Increase the time-out period by alering the config on your IIS server.
> Decrease the size of the recordset. Maybe use paging?
> Brian Lowe
> ---@.
> "Joe Coppola" <jocojr@.hotmail.com> wrote in message
> news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
> > Hi there.
> > I am having a weird problem. Currently I have a straight ASP page that
> > queries an Access database and returns the large recordset on a page
that
> > loops through the recordset and writes the appropriate <td> tags in
order
> to
> > put the data into a table. Now when I run it in my test environment it
> runs
> > no problem, however when I upload to my ISP I get a iis 500 error. But
no
> > error on test server.
> > A few things: I have noticed that if I decrease the the number of
> > Response.Write and rstSearch.Fields("FIeldName") code lines that it
works
> > ok on the ISP server.
> > Any ideas?
> > Joe
strange & weird problem in ASP.NET application
multiple users access the web site, the changes done by a user gets
reflected in another users session.
I have some global variables declared in a module which I use
throughout the application. Is it problem because of this? If I cant
declare a global variable in a module where else can I declare it
where it cannot be changed when multiple users are accessing the same
variable?
Please somebody help me.
-Shalinthat would be the difference betueen session variables and application
variables
you would need session variables
have a look at the pass variables value between diferent pages thread
hope it helps
eric
"shalin" <shalin@.imagine.co.in> wrote in message
news:2acc1eb4.0402260345.4dd44352@.posting.google.c om...
> I am having a strange problem in my ASP.NET application. When
> multiple users access the web site, the changes done by a user gets
> reflected in another users session.
> I have some global variables declared in a module which I use
> throughout the application. Is it problem because of this? If I cant
> declare a global variable in a module where else can I declare it
> where it cannot be changed when multiple users are accessing the same
> variable?
> Please somebody help me.
> -Shalin
Wednesday, March 28, 2012
Strange cache behavior
I get a datatable from cache:
dt = (DataTable) Cache[CacheKey];
Then, depending on selection in dropdown list I filter it:
DataView dv = dt.DefaultView;
if (cboStatus.SelectedIndex != 0)
{
int Status = int.Parse (cboStatus.SelectedItem.Value);
dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
}
And then, bind it to the datagrid:
grdMain.DataSource = dv;
grdMain.DataBind();
However, if dataview filter is set first time, it stays this way. What I
mean is the change in dataview gets stored in cache and dt = (DataTable)
Cache[CacheKey] brings back the old value on the next postback.
The question is this: if I add an item to cache and then modify this item,
would the modified item be automatically changed in cache? In other words,
is cache set by value or by reference?
Thanks,
-StanWith reference types, by reference. A DataTable is a reference type.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Stan" <nospam@.yahoo.com> wrote in message
news:O8yxgvZmEHA.3900@.TK2MSFTNGP10.phx.gbl...
> Not sure if this is by design or not, but it looks weird.
> I get a datatable from cache:
> dt = (DataTable) Cache[CacheKey];
> Then, depending on selection in dropdown list I filter it:
> DataView dv = dt.DefaultView;
> if (cboStatus.SelectedIndex != 0)
> {
> int Status = int.Parse (cboStatus.SelectedItem.Value);
> dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
> }
> And then, bind it to the datagrid:
> grdMain.DataSource = dv;
> grdMain.DataBind();
> However, if dataview filter is set first time, it stays this way. What I
> mean is the change in dataview gets stored in cache and dt = (DataTable)
> Cache[CacheKey] brings back the old value on the next postback.
> The question is this: if I add an item to cache and then modify this item,
> would the modified item be automatically changed in cache? In other words,
> is cache set by value or by reference?
> Thanks,
> -Stan
if you dont want that behavior then always store a copy.
set a copy and get a copy
--
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:OYhkV$ZmEHA.3336@.TK2MSFTNGP10.phx.gbl...
> With reference types, by reference. A DataTable is a reference type.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> I get paid good money to
> solve puzzles for a living
> "Stan" <nospam@.yahoo.com> wrote in message
> news:O8yxgvZmEHA.3900@.TK2MSFTNGP10.phx.gbl...
>> Not sure if this is by design or not, but it looks weird.
>>
>> I get a datatable from cache:
>>
>> dt = (DataTable) Cache[CacheKey];
>>
>> Then, depending on selection in dropdown list I filter it:
>>
>> DataView dv = dt.DefaultView;
>> if (cboStatus.SelectedIndex != 0)
>> {
>> int Status = int.Parse (cboStatus.SelectedItem.Value);
>> dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
>> }
>>
>> And then, bind it to the datagrid:
>>
>> grdMain.DataSource = dv;
>> grdMain.DataBind();
>>
>> However, if dataview filter is set first time, it stays this way. What I
>> mean is the change in dataview gets stored in cache and dt = (DataTable)
>> Cache[CacheKey] brings back the old value on the next postback.
>>
>> The question is this: if I add an item to cache and then modify this
>> item,
>> would the modified item be automatically changed in cache? In other
>> words,
>> is cache set by value or by reference?
>>
>> Thanks,
>>
>> -Stan
>>
>>
Stan wrote:
>Not sure if this is by design or not, but it looks weird.
>I get a datatable from cache:
>dt = (DataTable) Cache[CacheKey];
>Then, depending on selection in dropdown list I filter it:
>DataView dv = dt.DefaultView;
>if (cboStatus.SelectedIndex != 0)
>{
> int Status = int.Parse (cboStatus.SelectedItem.Value);
> dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
>}
>And then, bind it to the datagrid:
>grdMain.DataSource = dv;
>grdMain.DataBind();
>However, if dataview filter is set first time, it stays this way. What I
>mean is the change in dataview gets stored in cache and dt = (DataTable)
>Cache[CacheKey] brings back the old value on the next postback.
>The question is this: if I add an item to cache and then modify this item,
>would the modified item be automatically changed in cache? In other words,
>is cache set by value or by reference?
>Thanks,
>-Stan
>
>
You need to update cache with the latest version. It doesn't
automatically update cache.
--
SevDer
http://www.sevder.com
> You need to update cache with the latest version. It doesn't
> automatically update cache.
That is what I thought, but it does update itslef by reference..
Yes Stan,
The Cache collection maintain the reference type objects by reference is by
design behavior and regarding on this, we can just think it as other
serverside data stores such as SessionState , ApplicationState...
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Stan,
Have you had any further ideas on this issue? If there is anything else we
can help, please feel free to post here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Strange cache behavior
I get a datatable from cache:
dt = (DataTable) Cache[CacheKey];
Then, depending on selection in dropdown list I filter it:
DataView dv = dt.DefaultView;
if (cboStatus.SelectedIndex != 0)
{
int Status = int.Parse (cboStatus.SelectedItem.Value);
dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
}
And then, bind it to the datagrid:
grdMain.DataSource = dv;
grdMain.DataBind();
However, if dataview filter is set first time, it stays this way. What I
mean is the change in dataview gets stored in cache and dt = (DataTable)
Cache[CacheKey] brings back the old value on the next postback.
The question is this: if I add an item to cache and then modify this item,
would the modified item be automatically changed in cache? In other words,
is cache set by value or by reference?
Thanks,
-StanWith reference types, by reference. A DataTable is a reference type.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
"Stan" <nospam@.yahoo.com> wrote in message
news:O8yxgvZmEHA.3900@.TK2MSFTNGP10.phx.gbl...
> Not sure if this is by design or not, but it looks weird.
> I get a datatable from cache:
> dt = (DataTable) Cache[CacheKey];
> Then, depending on selection in dropdown list I filter it:
> DataView dv = dt.DefaultView;
> if (cboStatus.SelectedIndex != 0)
> {
> int Status = int.Parse (cboStatus.SelectedItem.Value);
> dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
> }
> And then, bind it to the datagrid:
> grdMain.DataSource = dv;
> grdMain.DataBind();
> However, if dataview filter is set first time, it stays this way. What I
> mean is the change in dataview gets stored in cache and dt = (DataTable)
> Cache[CacheKey] brings back the old value on the next postback.
> The question is this: if I add an item to cache and then modify this item,
> would the modified item be automatically changed in cache? In other words,
> is cache set by value or by reference?
> Thanks,
> -Stan
>
if you dont want that behavior then always store a copy.
set a copy and get a copy
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:OYhkV$ZmEHA.3336@.TK2MSFTNGP10.phx.gbl...
> With reference types, by reference. A DataTable is a reference type.
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> I get paid good money to
> solve puzzles for a living
> "Stan" <nospam@.yahoo.com> wrote in message
> news:O8yxgvZmEHA.3900@.TK2MSFTNGP10.phx.gbl...
>
Stan wrote:
>Not sure if this is by design or not, but it looks weird.
>I get a datatable from cache:
>dt = (DataTable) Cache[CacheKey];
>Then, depending on selection in dropdown list I filter it:
>DataView dv = dt.DefaultView;
>if (cboStatus.SelectedIndex != 0)
>{
> int Status = int.Parse (cboStatus.SelectedItem.Value);
> dv.RowFilter = string.Format ("CollectionStatusKey = {0}", Status);
>}
>And then, bind it to the datagrid:
>grdMain.DataSource = dv;
>grdMain.DataBind();
>However, if dataview filter is set first time, it stays this way. What I
>mean is the change in dataview gets stored in cache and dt = (DataTable)
>Cache[CacheKey] brings back the old value on the next postback.
>The question is this: if I add an item to cache and then modify this item,
>would the modified item be automatically changed in cache? In other words,
>is cache set by value or by reference?
>Thanks,
>-Stan
>
>
You need to update cache with the latest version. It doesn't
automatically update cache.
SevDer
http://www.sevder.com
> You need to update cache with the latest version. It doesn't
> automatically update cache.
That is what I thought, but it does update itslef by reference..
Yes Stan,
The Cache collection maintain the reference type objects by reference is by
design behavior and regarding on this, we can just think it as other
serverside data stores such as SessionState , ApplicationState...
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Stan,
Have you had any further ideas on this issue? If there is anything else we
can help, please feel free to post here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Monday, March 26, 2012
Strange DBNULL Error - Please Help!
I'm having a very weird problem. Any hints are greatly appreciated.
I'm returning two values from a MS SQL Server 2000 stored procedure to my
Webapplication and store them in sessions.
Like This:
prm4 = cmd1.CreateParameter
With prm4
..ParameterName = "@dotnet.itags.org.Sec_ProgUser_Gen"
..SqlDbType = SqlDbType.VarChar
..Size = 10
..Direction = ParameterDirection.Output
End With
prm5 = cmd1.CreateParameter
With prm5
..ParameterName = "@dotnet.itags.org.Sec_ProgUser_Key"
..SqlDbType = SqlDbType.VarChar
..Size = 10
..Direction = ParameterDirection.Output
End With
...
cmd1.ExecuteNonQuery()
...
Session("Sec_ProgUser_Gen") = prm4.Value
Session("Sec_ProgUser_Key") = prm5.Value
Both output parameters are declared as varchar(10) within the stored
procedure. If I run the stored procedure in SQL Analyzer, I'm getting a
string value for each of them. E.g. @dotnet.itags.org.Sec_ProgUser_Gen is "1110011",
@dotnet.itags.org.Sec_ProgUser_Key = "1100".
Now the strange thing happens if I try to run the following code:
Sub MyTest()
Dim MyString1 As String
Dim MyString2 As String
MyString1 = CStr(Session("Sec_ProgClient_Key"))
...
MyString2 = CStr(Session("Sec_ProgUser_Gen"))
End Sub
It fails in line 'MyString2 = CStr(Session("Sec_ProgUser_Gen"))' with Cast
from type 'DBNull' to type 'String' is not valid.
I don't understand this. They are both the same, the only difference is the
length of the string. Help!
Additional Information:
The values for @dotnet.itags.org.Sec_ProgUser_XXX are created in the stored procedure with a
statement like this:
SET @dotnet.itags.org.Sec_ProgUser_Key = (SELECT Convert(varchar(1),Key_CanCreateKey) +
Convert(varchar(1),Key_CanCreateTransaction) +
Convert(varchar(1),Key_CanView) + Convert(varchar(1),Key_CanDelete) FROM
i2b_proguser_securityprofile WHERE SecurityProfileID = @dotnet.itags.org.SecurityProfileID)
The datatype of the source columns used to be bit then changed them to
Integer as I thought this might cause the problem. (Although it shouldn't as
the values get converted to varchar without a problem in the stored
procedure. No fields contain NULL values, only 1 or 0.Did you figure this out?
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Martin" <theintrepidfox@.hotmail.com> wrote in message
news:7217238c.0401221018.3b36790a@.posting.google.c om...
> Dear Group
> I'm having a very weird problem. Any hints are greatly appreciated.
> I'm returning two values from a MS SQL Server 2000 stored procedure to my
> Webapplication and store them in sessions.
> Like This:
> prm4 = cmd1.CreateParameter
> With prm4
> .ParameterName = "@.Sec_ProgUser_Gen"
> .SqlDbType = SqlDbType.VarChar
> .Size = 10
> .Direction = ParameterDirection.Output
> End With
> prm5 = cmd1.CreateParameter
> With prm5
> .ParameterName = "@.Sec_ProgUser_Key"
> .SqlDbType = SqlDbType.VarChar
> .Size = 10
> .Direction = ParameterDirection.Output
> End With
> ...
> cmd1.ExecuteNonQuery()
> ...
> Session("Sec_ProgUser_Gen") = prm4.Value
> Session("Sec_ProgUser_Key") = prm5.Value
> Both output parameters are declared as varchar(10) within the stored
> procedure. If I run the stored procedure in SQL Analyzer, I'm getting a
> string value for each of them. E.g. @.Sec_ProgUser_Gen is "1110011",
> @.Sec_ProgUser_Key = "1100".
> Now the strange thing happens if I try to run the following code:
> Sub MyTest()
> Dim MyString1 As String
> Dim MyString2 As String
> MyString1 = CStr(Session("Sec_ProgClient_Key"))
> ...
> MyString2 = CStr(Session("Sec_ProgUser_Gen"))
> End Sub
> It fails in line 'MyString2 = CStr(Session("Sec_ProgUser_Gen"))' with Cast
> from type 'DBNull' to type 'String' is not valid.
> I don't understand this. They are both the same, the only difference is
the
> length of the string. Help!
> Additional Information:
> The values for @.Sec_ProgUser_XXX are created in the stored procedure with
a
> statement like this:
> SET @.Sec_ProgUser_Key = (SELECT Convert(varchar(1),Key_CanCreateKey) +
> Convert(varchar(1),Key_CanCreateTransaction) +
> Convert(varchar(1),Key_CanView) + Convert(varchar(1),Key_CanDelete) FROM
> i2b_proguser_securityprofile WHERE SecurityProfileID = @.SecurityProfileID)
> The datatype of the source columns used to be bit then changed them to
> Integer as I thought this might cause the problem. (Although it shouldn't
as
> the values get converted to varchar without a problem in the stored
> procedure. No fields contain NULL values, only 1 or 0.
Hi Alvin
Yes. Thanks for asking. Forgot OUTPUT for @.Sec_ProgUser_Gen
"Alvin Bruney" <vapor at steaming post office> wrote in message news:<OFZOOxs4DHA.1504@.TK2MSFTNGP12.phx.gbl>...
> Did you figure this out?
> --
> Regards,
> Alvin Bruney [ASP.NET MVP]
> Got tidbits? Get it here...
> http://tinyurl.com/3he3b
> "Martin" <theintrepidfox@.hotmail.com> wrote in message
> news:7217238c.0401221018.3b36790a@.posting.google.c om...
> > Dear Group
> > I'm having a very weird problem. Any hints are greatly appreciated.
> > I'm returning two values from a MS SQL Server 2000 stored procedure to my
> > Webapplication and store them in sessions.
> > Like This:
> > prm4 = cmd1.CreateParameter
> > With prm4
> > .ParameterName = "@.Sec_ProgUser_Gen"
> > .SqlDbType = SqlDbType.VarChar
> > .Size = 10
> > .Direction = ParameterDirection.Output
> > End With
> > prm5 = cmd1.CreateParameter
> > With prm5
> > .ParameterName = "@.Sec_ProgUser_Key"
> > .SqlDbType = SqlDbType.VarChar
> > .Size = 10
> > .Direction = ParameterDirection.Output
> > End With
> > ...
> > cmd1.ExecuteNonQuery()
> > ...
> > Session("Sec_ProgUser_Gen") = prm4.Value
> > Session("Sec_ProgUser_Key") = prm5.Value
> > Both output parameters are declared as varchar(10) within the stored
> > procedure. If I run the stored procedure in SQL Analyzer, I'm getting a
> > string value for each of them. E.g. @.Sec_ProgUser_Gen is "1110011",
> > @.Sec_ProgUser_Key = "1100".
> > Now the strange thing happens if I try to run the following code:
> > Sub MyTest()
> > Dim MyString1 As String
> > Dim MyString2 As String
> > MyString1 = CStr(Session("Sec_ProgClient_Key"))
> > ...
> > MyString2 = CStr(Session("Sec_ProgUser_Gen"))
> > End Sub
> > It fails in line 'MyString2 = CStr(Session("Sec_ProgUser_Gen"))' with Cast
> > from type 'DBNull' to type 'String' is not valid.
> > I don't understand this. They are both the same, the only difference is
> the
> > length of the string. Help!
> > Additional Information:
> > The values for @.Sec_ProgUser_XXX are created in the stored procedure with
> a
> > statement like this:
> > SET @.Sec_ProgUser_Key = (SELECT Convert(varchar(1),Key_CanCreateKey) +
> > Convert(varchar(1),Key_CanCreateTransaction) +
> > Convert(varchar(1),Key_CanView) + Convert(varchar(1),Key_CanDelete) FROM
> > i2b_proguser_securityprofile WHERE SecurityProfileID = @.SecurityProfileID)
> > The datatype of the source columns used to be bit then changed them to
> > Integer as I thought this might cause the problem. (Although it shouldn't
> as
> > the values get converted to varchar without a problem in the stored
> > procedure. No fields contain NULL values, only 1 or 0.
Thursday, March 22, 2012
Strange HttpContext issue
I've got a very weird situation I need help with. I'm building a
solution where I have custom components in a web content management
system using a web store library (API in DLLs). The CMS is using Forms
authentication to verify users when they log in. I log the user in
using the following code:
private bool AttemptLogon( string username, string password )
{
_errorMessage = "";
Customer customer = new Customer();
try
{
if (Customer.Login(username,password))
{
FormsAuthentication.SetAuthCookie(username,false,
"/boksala");
string redirecturl = (string)Session["oshopredirecturl"];
if (redirecturl != null && redirecturl != string.Empty)
{
Session.Abandon();
Response.Redirect( redirecturl );
}
else
{
Response.Redirect(HttpUrlBuilder.GetStoreHomePage().ToString());
}
return true;
}
else
{
_errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
return false;
}
}
catch(AccountDisabledException)
{
_errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
}
return false;
}
After this is run, and a valid user is provided, the
HttpContext.Current.User.IsAuthenticated returns true and all is well.
When I then debug the 3rd party web store API DLL, everything turns
strange! The authentication type is all of a sudden Windows
Authentication, and IsAuthenticated returns false! How can this be? Is
there any possibility that there are two different HttpContexts? This
is within the same aspx page, and the context should therefore be the
same. I'm not sure if the 3rd Party API does something to change the
authentication mode all of a sudden, and I've searched for any
explanation in vain. Any ideas?
ThanksOne good place to start is with the API documentation. Have a look to see
how it handles authentication in a server environment.
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
----
"Torfi" <torfig@.gmail.com> wrote in message
news:1149265535.183815.269420@.i40g2000cwc.googlegroups.com...
> Hello all
> I've got a very weird situation I need help with. I'm building a
> solution where I have custom components in a web content management
> system using a web store library (API in DLLs). The CMS is using Forms
> authentication to verify users when they log in. I log the user in
> using the following code:
> private bool AttemptLogon( string username, string password )
> {
> _errorMessage = "";
> Customer customer = new Customer();
> try
> {
> if (Customer.Login(username,password))
> {
> FormsAuthentication.SetAuthCookie(username,false,
> "/boksala");
> string redirecturl = (string)Session["oshopredirecturl"];
> if (redirecturl != null && redirecturl != string.Empty)
> {
> Session.Abandon();
> Response.Redirect( redirecturl );
> }
> else
> {
> Response.Redirect(HttpUrlBuilder.GetStoreHomePage().ToString());
> }
> return true;
> }
> else
> {
> _errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
> return false;
> }
> }
> catch(AccountDisabledException)
> {
> _errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
> }
> return false;
> }
> After this is run, and a valid user is provided, the
> HttpContext.Current.User.IsAuthenticated returns true and all is well.
> When I then debug the 3rd party web store API DLL, everything turns
> strange! The authentication type is all of a sudden Windows
> Authentication, and IsAuthenticated returns false! How can this be? Is
> there any possibility that there are two different HttpContexts? This
> is within the same aspx page, and the context should therefore be the
> same. I'm not sure if the 3rd Party API does something to change the
> authentication mode all of a sudden, and I've searched for any
> explanation in vain. Any ideas?
> Thanks
>
Strange HttpContext issue
I've got a very weird situation I need help with. I'm building a
solution where I have custom components in a web content management
system using a web store library (API in DLLs). The CMS is using Forms
authentication to verify users when they log in. I log the user in
using the following code:
private bool AttemptLogon( string username, string password )
{
_errorMessage = "";
Customer customer = new Customer();
try
{
if (Customer.Login(username,password))
{
FormsAuthentication.SetAuthCookie(username,false,
"/boksala");
string redirecturl = (string)Session["oshopredirecturl"];
if (redirecturl != null && redirecturl != string.Empty)
{
Session.Abandon();
Response.Redirect( redirecturl );
}
else
{
Response.Redirect(HttpUrlBuilder.GetStoreHomePage( ).ToString());
}
return true;
}
else
{
_errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
return false;
}
}
catch(AccountDisabledException)
{
_errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
}
return false;
}
After this is run, and a valid user is provided, the
HttpContext.Current.User.IsAuthenticated returns true and all is well.
When I then debug the 3rd party web store API DLL, everything turns
strange! The authentication type is all of a sudden Windows
Authentication, and IsAuthenticated returns false! How can this be? Is
there any possibility that there are two different HttpContexts? This
is within the same aspx page, and the context should therefore be the
same. I'm not sure if the 3rd Party API does something to change the
authentication mode all of a sudden, and I've searched for any
explanation in vain. Any ideas?
ThanksOne good place to start is with the API documentation. Have a look to see
how it handles authentication in a server environment.
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-----------------
"Torfi" <torfig@.gmail.com> wrote in message
news:1149265535.183815.269420@.i40g2000cwc.googlegr oups.com...
> Hello all
> I've got a very weird situation I need help with. I'm building a
> solution where I have custom components in a web content management
> system using a web store library (API in DLLs). The CMS is using Forms
> authentication to verify users when they log in. I log the user in
> using the following code:
> private bool AttemptLogon( string username, string password )
> {
> _errorMessage = "";
> Customer customer = new Customer();
> try
> {
> if (Customer.Login(username,password))
> {
> FormsAuthentication.SetAuthCookie(username,false,
> "/boksala");
> string redirecturl = (string)Session["oshopredirecturl"];
> if (redirecturl != null && redirecturl != string.Empty)
> {
> Session.Abandon();
> Response.Redirect( redirecturl );
> }
> else
> {
> Response.Redirect(HttpUrlBuilder.GetStoreHomePage( ).ToString());
> }
> return true;
> }
> else
> {
> _errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
> return false;
> }
> }
> catch(AccountDisabledException)
> {
> _errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
> }
> return false;
> }
> After this is run, and a valid user is provided, the
> HttpContext.Current.User.IsAuthenticated returns true and all is well.
> When I then debug the 3rd party web store API DLL, everything turns
> strange! The authentication type is all of a sudden Windows
> Authentication, and IsAuthenticated returns false! How can this be? Is
> there any possibility that there are two different HttpContexts? This
> is within the same aspx page, and the context should therefore be the
> same. I'm not sure if the 3rd Party API does something to change the
> authentication mode all of a sudden, and I've searched for any
> explanation in vain. Any ideas?
> Thanks
Tuesday, March 13, 2012
strange problem on ASPX page--loose the WebUIValidation.js
It shows this error.
Unable to find script library
'/aspnet_client/system_web/1_1_4322/WebUIValidation.js'.
then it turns black, doesn't show the header.ascx control and locks up the
site.
Any ideas.
No other pages seem to have problems finding this sucker.
I really need a fix for this.
Thanks,
Shanei've seen this problem before and if it only happens on this page and no
other page in the application (the preceeding must absolutely be true)
what you need to do is insert a new aspx page and copy your controls over to
this new page. Essentially you need to build a new page and cut and paste
the controls and code to this new form. Then rebuild the project. I've had
success but only if the condition above is met.
"SStory" <TheStorys@.TAKETHISSPAMBUSTEROUT.Softhome.net> wrote in message
news:u9Sk5r1kDHA.2232@.TK2MSFTNGP09.phx.gbl...
> for one page in my application something weird happens.
> It shows this error.
> Unable to find script library
> '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'.
> then it turns black, doesn't show the header.ascx control and locks up the
> site.
> Any ideas.
> No other pages seem to have problems finding this sucker.
> I really need a fix for this.
> Thanks,
> Shane
Thanks Alvin.
Guess I'll have to try that. Seems there has to be an easier way of just
correcting something in the page, but...
Maybe a Microsoft person reading this can answer this issue in a better
manner for us all.
Thanks,
Shane
"Alvin Bruney" <vapordan_spam_me_not@.hotmail_no_spamhotmail.com> wrote in
message news:%23H$n7U4kDHA.424@.TK2MSFTNGP10.phx.gbl...
> i've seen this problem before and if it only happens on this page and no
> other page in the application (the preceeding must absolutely be true)
> what you need to do is insert a new aspx page and copy your controls over
to
> this new page. Essentially you need to build a new page and cut and paste
> the controls and code to this new form. Then rebuild the project. I've had
> success but only if the condition above is met.
> "SStory" <TheStorys@.TAKETHISSPAMBUSTEROUT.Softhome.net> wrote in message
> news:u9Sk5r1kDHA.2232@.TK2MSFTNGP09.phx.gbl...
> > for one page in my application something weird happens.
> > It shows this error.
> > Unable to find script library
> > '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'.
> > then it turns black, doesn't show the header.ascx control and locks up
the
> > site.
> > Any ideas.
> > No other pages seem to have problems finding this sucker.
> > I really need a fix for this.
> > Thanks,
> > Shane