Saturday, March 31, 2012
There is an invalid sequence in the string. Error problem
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />
But i get error:- Invalid URI: There is an invalid sequence in the string. "
What could be the problem!!!You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
with
<%#
String.Format(".../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>
Regards,
Tasos
Patrick.O.Ige wrote:
> I have this below in a Datalist:-
> <asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
> DataBinder.Eval(Container.DataItem, "cat_cities")%>'
> NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
> DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
> DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
> Container.ItemIndex %>'
> runat="server" />
> But i get error:- Invalid URI: There is an invalid sequence in the string.
"
> What could be the problem!!!
I'm getting frustrated with this error i'm using :-
Dim link As String =
String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"), e.Item.ItemIndex)
Still getting the same error
What could be wrong!!!!!!!!!!!!!!!
"Tasos Vogiatzoglou" <tvoglou@.gmail.com> wrote in message
news:1151847930.414392.191900@.b68g2000cwa.googlegroups.com...
> You should replace <%# "../Showcrete.aspx?CategoryID=" &
> DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
> DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
> Container.ItemIndex %>'
> with
> <%#
> String.Format(".../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
> ((DataRowView)Container.DataItem)["mcatid"],
> ((DataRowView)Container.DataItem)["cat_cities"],
> Container.ItemIndex) %>
> Regards,
> Tasos
> Patrick.O.Ige wrote:
>
There is an invalid sequence in the string. Error problem
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />
But i get error:- Invalid URI: There is an invalid sequence in the string. "
What could be the problem!!!You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
with
<%#
String.Format(".../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>
Regards,
Tasos
Patrick.O.Ige wrote:
Quote:
Originally Posted by
I have this below in a Datalist:-
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />
>
But i get error:- Invalid URI: There is an invalid sequence in the string. "
What could be the problem!!!
I'm getting frustrated with this error i'm using :-
Dim link As String =
String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"), e.Item.ItemIndex)
Still getting the same error
What could be wrong!!!!!!!!!!!!!!!
"Tasos Vogiatzoglou" <tvoglou@.gmail.comwrote in message
news:1151847930.414392.191900@.b68g2000cwa.googlegr oups.com...
Quote:
Originally Posted by
You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
>
with
>
<%#
String.Format(".../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>
>
Regards,
Tasos
>
Patrick.O.Ige wrote:
Quote:
Originally Posted by
>I have this below in a Datalist:-
><asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
>DataBinder.Eval(Container.DataItem, "cat_cities")%>'
>NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
>DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
>DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
>Container.ItemIndex %>'
>runat="server" />
>>
>But i get error:- Invalid URI: There is an invalid sequence in the
>string. "
>What could be the problem!!!
>
Could you provide a stacktrace ?
(Btw... the code was in C#, I don't know if it's applicable to VB.NET)
Regards,
Tasos
Patrick.O.Ige wrote:
Quote:
Originally Posted by
I'm getting frustrated with this error i'm using :-
Dim link As String =
String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"), e.Item.ItemIndex)
Still getting the same error
What could be wrong!!!!!!!!!!!!!!!
>
>
"Tasos Vogiatzoglou" <tvoglou@.gmail.comwrote in message
news:1151847930.414392.191900@.b68g2000cwa.googlegr oups.com...
Quote:
Originally Posted by
You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
with
<%#
String.Format(".../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>
Regards,
Tasos
Patrick.O.Ige wrote:
Quote:
Originally Posted by
I have this below in a Datalist:-
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />
>
But i get error:- Invalid URI: There is an invalid sequence in the
string. "
What could be the problem!!!
Tasos thanks i converted it to VB.NET
Actually i had to use ToString() and then used Server.UrlEncode
before i could get some positive result.
"Tasos Vogiatzoglou" <tvoglou@.gmail.comwrote in message
news:1152030342.063452.287830@.h44g2000cwa.googlegr oups.com...
Quote:
Originally Posted by
Could you provide a stacktrace ?
(Btw... the code was in C#, I don't know if it's applicable to VB.NET)
>
Regards,
Tasos
>
>
Patrick.O.Ige wrote:
Quote:
Originally Posted by
>I'm getting frustrated with this error i'm using :-
> Dim link As String =
>String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
>e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"),
>e.Item.ItemIndex)
>Still getting the same error
>What could be wrong!!!!!!!!!!!!!!!
>>
>>
>"Tasos Vogiatzoglou" <tvoglou@.gmail.comwrote in message
>news:1151847930.414392.191900@.b68g2000cwa.googlegr oups.com...
Quote:
Originally Posted by
You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
>
with
>
<%#
String.Format(".../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>
>
Regards,
Tasos
>
Patrick.O.Ige wrote:
>I have this below in a Datalist:-
><asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
>DataBinder.Eval(Container.DataItem, "cat_cities")%>'
>NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
>DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
>DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
>Container.ItemIndex %>'
>runat="server" />
>>
>But i get error:- Invalid URI: There is an invalid sequence in the
>string. "
>What could be the problem!!!
>
>
Monday, March 26, 2012
this is strange....
asp.net 2.0
My problem is that the image web server control (see below) won't display
the image if web.config have this setting:
<authorization>
<deny users="?" />
</authorization>
<asp:Image ID="logo" runat="server" ImageUrl="~/logo.png" />
Any ideas what I should do to solve this so the image is displayed if
web.config have
<authorization>
<deny users="?" />
</authorization>
Best Regards!
JeffThis web page uses a theme
and it looks like the page can't use the theme either if
<authorization>
<deny users="?" />
</authorization>
<pages theme="Standard" maintainScrollPositionOnPostBack="true"></pages>
any suggestions?
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:OFg7n$w4GHA.1460@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Hey
>
asp.net 2.0
>
My problem is that the image web server control (see below) won't display
the image if web.config have this setting:
<authorization>
<deny users="?" />
</authorization>
>
<asp:Image ID="logo" runat="server" ImageUrl="~/logo.png" />
>
Any ideas what I should do to solve this so the image is displayed if
web.config have
<authorization>
<deny users="?" />
</authorization>
>
>
Best Regards!
>
Jeff
>
"?" stands for anonymous users and "*" for all users. So,
<allow users="Jv"/>
<deny users="?"/>
will allow user "Jv" but deny all anonymous users. You can use to separate
multiple identiies.
<allow users="Jv, Kylin"/>
<deny users="?"/>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message news:OjhGjTx4GHA.4352@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
This web page uses a theme
>
and it looks like the page can't use the theme either if
<authorization>
<deny users="?" />
</authorization>
>
<pages theme="Standard" maintainScrollPositionOnPostBack="true"></pages>
>
any suggestions?
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message news:OFg7n$w4GHA.1460@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
>Hey
>>
>asp.net 2.0
>>
>My problem is that the image web server control (see below) won't display the image if web.config have this setting:
><authorization>
> <deny users="?" />
></authorization>
>>
><asp:Image ID="logo" runat="server" ImageUrl="~/logo.png" />
>>
>Any ideas what I should do to solve this so the image is displayed if web.config have
><authorization>
> <deny users="?" />
></authorization>
>>
>>
>Best Regards!
>>
>Jeff
>>
>
>
thanks!
"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot comwrote in message
news:OIVEUIz4GHA.3512@.TK2MSFTNGP04.phx.gbl...
Quote:
Originally Posted by
"?" stands for anonymous users and "*" for all users. So,
>
<allow users="Jv"/>
<deny users="?"/>
>
will allow user "Jv" but deny all anonymous users. You can use to separate
multiple identiies.
>
<allow users="Jv, Kylin"/>
<deny users="?"/>
>
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:OjhGjTx4GHA.4352@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
>This web page uses a theme
>>
>and it looks like the page can't use the theme either if
><authorization>
> <deny users="?" />
></authorization>
>>
><pages theme="Standard" maintainScrollPositionOnPostBack="true"></pages>
>>
>any suggestions?
>>
>>
>"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
>news:OFg7n$w4GHA.1460@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
>>Hey
>>>
>>asp.net 2.0
>>>
>>My problem is that the image web server control (see below) won't
>>display the image if web.config have this setting:
>><authorization>
>> <deny users="?" />
>></authorization>
>>>
>><asp:Image ID="logo" runat="server" ImageUrl="~/logo.png" />
>>>
>>Any ideas what I should do to solve this so the image is displayed if
>>web.config have
>><authorization>
>> <deny users="?" />
>></authorization>
>>>
>>>
>>Best Regards!
>>>
>>Jeff
>>>
>>
>>
>
>
This is very odd?? cant think of a descriptive title(files opened in different folder, ign
Sorry about the rubish title, this problem has really confused me. Here we go....
(not valid web addresses below, just an example)
I created a page called thepage.aspx in the web folder Myweb.co.uk/sites/thepage.apsx when i openwww.myweb.co.uk/sites/thepage.aspx, for some reason the page that is opened iswww.myweb.co.uk/different/folder/thepage.aspx (but the browser address bar displays the correct address)
thepage.aspx, could be default.aspx or contact.aspx, so for different sites desplays different info. Why would the browser goto the address and instead of reading the file thats right in front of it, go to a totaly differnt folder, and find a file with the same name and display that?
Please can someone help me on this odd event... i am extreamy puzzeled and cant think of any reason why?
Thank you for your time
Darren.breenen--
Regarding this...
breenen wrote:
...Sorry about the rubish title, this problem has really confused me. Here we go....
(not valid web addresses below, just an example)
I created a page called thepage.aspx in the web folder Myweb.co.uk/sites/thepage.apsx when i openwww.myweb.co.uk/sites/thepage.aspx, for some reason the page that is opened iswww.myweb.co.uk/different/folder/thepage.aspx (but the browser address bar displays the correct address)...Please can someone help me on this odd event... i am extreamy puzzeled and cant think of any reason why?...
...it looks like the site where you are building your page has subdomains and/or virtual directories setup...
...your hosting provider should be able to give you the actual map of apparent-names to actual-locations...
...in short, the general idea behind a virtual directory is that one can create a directory namedhttp://LocalHost/MySite and then make that "virtual directory" point to the actual-directory of c:\myMachineName\MyFolder\MySubFolder\ , or any other local physical directory. This allows one to create "friendly" site names and it makes it easier to create/delete/change the physical locations of a site without having to change the "virtual" address. The odd part is that depending upon how one accesses the files, one may see the virtual-path or the actual-path at a given time, which is what seems to be happening to you.
Sub-domains are similar to and leverage the concept of a virtual directory with the added affect that they can be "piggy-backed" off of an existing domain name. Suppose that one owns the domainhttp://www.WebLogicArts.com then that person can create any number of "sub-domain names" based on that domain, (provided the hosting company allows that), and those sub-domains would look generally like thishttp://MySubDomain1.WebLogicArts.com ,http://MySubDomain2.WebLogicArts.com ,http://MySubDomain3.WebLogicArts.com and so on.
HTH.
Thank you.
Tuesday, March 13, 2012
Thread was being aborted
When I do the Login using the code below I am getting the
System.Thread.ThreadAbortException(Thread was being abortefd) on the last
line of the below code i.e.
Response.RedirectFormsAuthentication.GetRedirectUrluID,isPersistent));
there is no original URL, therefore it is returning Default.aspx.
I don't know why I am getting the above exception.
private void ButtonLogin_Click(object sender, System.EventArgs e)
{
string sessionID = "";
string uID = txtUsername.Text;
string pwd = txtPassword.Text;
bool isPersistent = false; try
{
ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
sessionID);
string userData = sessionID;
switch(loginResult)
{
case ESMLoginResultEnum.OK:
{
FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.Now,System.DateTime.Now.AddM
inutes(AUTH_TIMEOUT),isPersistent,userDa
ta,FormsAuthentication.FormsCookiePa
th);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new
HttpCookie(FormsAuthentication.FormsCookieName,encTicket);
cookie.Path = FormsAuthentication.FormsCookiePath;
// Create the cookie.
Response.Cookies.Add(cookie);
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectUrl(uID,isPersistent));
break;
}
}
}
}
Regards,
EktaEnhar:
Response.Redirect("someUrl") always throws a threadAbort exception.
Response.Reidrect("someUrl") calls Response.Redirect("someUrl", true)
with true meaning "end the response". So Response.End() is called which
throws that exception.
If you want, you can avoid the error by doing Response.ReidrecT("someUrl",
false)
or you could swollow the exception in a try/catch
try{
Response.Redirect("someUrl")
}catch (ThreadAbortException ex){}
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"enahar" <enahar@.hotmail.com> wrote in message
news:e092bRsIFHA.3628@.TK2MSFTNGP15.phx.gbl...
> Hi,
> When I do the Login using the code below I am getting the
> System.Thread.ThreadAbortException(Thread was being abortefd) on the last
> line of the below code i.e.
> Response.RedirectFormsAuthentication.GetRedirectUrluID,isPersistent));
> there is no original URL, therefore it is returning Default.aspx.
>
> I don't know why I am getting the above exception.
>
>
> private void ButtonLogin_Click(object sender, System.EventArgs e)
> {
> string sessionID = "";
> string uID = txtUsername.Text;
> string pwd = txtPassword.Text;
>
> bool isPersistent = false; try
> {
> ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
> sessionID);
> string userData = sessionID;
> switch(loginResult)
> {
> case ESMLoginResultEnum.OK:
> {
> FormsAuthenticationTicket ticket = new
>
FormsAuthenticationTicket(1,uID,System.DateTime.Now,System.DateTime.Now.AddM
inutes(AUTH_TIMEOUT),isPersistent,userDa
ta,FormsAuthentication.FormsCookiePa
th);
> // Encrypt the ticket.
> string encTicket = FormsAuthentication.Encrypt(ticket);
> HttpCookie cookie = new
> HttpCookie(FormsAuthentication.FormsCookieName,encTicket);
> cookie.Path = FormsAuthentication.FormsCookiePath;
> // Create the cookie.
> Response.Cookies.Add(cookie);
> // Redirect back to original URL.
> Response.Redirect(FormsAuthentication.GetRedirectUrl(uID,isPersistent));
>
> break;
> }
> }
> }
> }
>
> Regards,
> Ekta
>
>
Hi,
Session is still not timing out when there is no activity by the user for 15
minutes.
My web.config settings are as below.
also in the login page for the ticket I am adding 15 minutes.
What is wrong i am doing it..
Regards,
Ekta
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
uID,
System.DateTime.Now,
System.DateTime.Now.AddMinutes(15),
isPersistent,
userData,
FormsAuthentication.FormsCookiePath);
:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="AppConfiguration" type="PIT.ESH.Common.WebConfiguration,
PITSHCommon" />
</configSections>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Forms">
<forms loginUrl="Security/Login.aspx" protection="All" timeout="2" path="/"
/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
<trace enabled="true" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="2" />
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-AU"
uiCulture = "en-AU"
/>
</system.web>
<AppConfiguration>
<!-- Application Settings -->
<add key="Web.EnablePageCache" value="true" />
<add key="Web.PageCacheExpiresInSeconds" value="3600" />
<add key="Web.EnableSsl" value="False" />
<add key="DB.ConnectionString" value="Data Source=DEVTEST-SQL1;User
ID=sa;Password=;Initial Catalog=Genesis2" />
<add key="Copyright.Message" value=" 2001-04 Positive IT Solutions Pty
Ltd." />
<add key="Copyright.EMail" value="" />
</AppConfiguration>
<appSettings>
<add key="Copyright.EMail" value="Etivity@.Postitive-IT.com.au" />
</appSettings>
<system.runtime.remoting>
<application>
</application>
</system.runtime.remoting>
<location path="default.aspx">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
<location path="Security">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>
<location path="Public">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
</configuration>
On Mon, 7 Mar 2005 17:09:01 +1100, "enahar" <enahar@.hotmail.com>
wrote:
>Hi,
>Session is still not timing out when there is no activity by the user for 1
5
>minutes.
>My web.config settings are as below.
>also in the login page for the ticket I am adding 15 minutes.
>
>What is wrong i am doing it..
>
>Regards,
>Ekta
>
Hi Etka:
Are you testing the Session timeout or the forms authentication ticket
timeout?
Scott
http://www.OdeToCode.com/blogs/scott/
I am writing the following code in the web.config file and the Login.aspx.cs
for the sessiopn TimeOut and for the forms authentication ticket timeout.
Also I am writing the following code in the Body tag of the Login.aspx page
<meta http-equiv="Refresh" URL="../Security/Login.aspx>
even then Session is still not timing out when there is no activity by the
user for 15 minutes.What is wrong I am doing it.Please suggest.
code in the session_end is as follows:
protected void Session_End(Object sender, EventArgs e)
{
FormsAuthentication.SignOut();
if (Session["SessionID"] != null)
{
try
{
ESMSecurityModule.killSession(Session["SessionID"].ToString());
}
catch
{
}
}
}
WEB.CONFIG
<authentication mode="Forms">
<forms loginUrl="../Security/Login.aspx" protection="All" timeout="15"
path="/" />
</authentication>
and for the forms authentication ticket TimeOut I am writing the following
code in the Login.aspx page:
LOGIN.ASPX PAGE
FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.Now,System.DateTime.Now.AddM
inutes(15),false,userData,FormsAuthentic
ation.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new
HttpCookie(FormsAuthentication.FormsCookieName,encTicket);
cookie.Path = FormsAuthentication.FormsCookiePath;
// Create the cookie.
Response.Cookies.Add(cookie);
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectUrl(uID,isPersistent),false
);
Regards,
Ekta
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:l3vo21hihtmb3pauqj9sphjqorb7v225fk@.
4ax.com...
> On Mon, 7 Mar 2005 17:09:01 +1100, "enahar" <enahar@.hotmail.com>
> wrote:
>
> Hi Etka:
> Are you testing the Session timeout or the forms authentication ticket
> timeout?
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
Hi enahar:
Don't relay on the Session_End event. Have you tested by hitting the
site with the browser after over 15 minutes of inactivity?
Scott
http://www.OdeToCode.com/blogs/scott/
Yes I have tested by hitting the
site with the browser after over 15 minutes of inactivity?
Regards
Ekta
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
Thread was being aborted
When I do the Login using the code below I am getting the
System.Thread.ThreadAbortException(Thread was being abortefd) on the last
line of the below code i.e.
Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent));
there is no original URL, therefore it is returning Default.aspx.
I don't know why I am getting the above exception.
private void ButtonLogin_Click(object sender, System.EventArgs e)
{
string sessionID = "";
string uID = txtUsername.Text;
string pwd = txtPassword.Text;
bool isPersistent = false; try
{
ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
sessionID);
string userData = sessionID;
switch(loginResult)
{
case ESMLoginResultEnum.OK:
{
FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new
HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
cookie.Path = FormsAuthentication.FormsCookiePath;
// Create the cookie.
Response.Cookies.Add(cookie);
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent));
break;
}
}
}
}
Regards,
EktaEnhar:
Response.Redirect("someUrl") always throws a threadAbort exception.
Response.Reidrect("someUrl") calls Response.Redirect("someUrl", true)
with true meaning "end the response". So Response.End() is called which
throws that exception.
If you want, you can avoid the error by doing Response.ReidrecT("someUrl",
false)
or you could swollow the exception in a try/catch
try{
Response.Redirect("someUrl")
}catch (ThreadAbortException ex){}
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"enahar" <enahar@.hotmail.com> wrote in message
news:e092bRsIFHA.3628@.TK2MSFTNGP15.phx.gbl...
> Hi,
> When I do the Login using the code below I am getting the
> System.Thread.ThreadAbortException(Thread was being abortefd) on the last
> line of the below code i.e.
> Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent));
> there is no original URL, therefore it is returning Default.aspx.
>
> I don't know why I am getting the above exception.
>
>
> private void ButtonLogin_Click(object sender, System.EventArgs e)
> {
> string sessionID = "";
> string uID = txtUsername.Text;
> string pwd = txtPassword.Text;
>
> bool isPersistent = false; try
> {
> ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
> sessionID);
> string userData = sessionID;
> switch(loginResult)
> {
> case ESMLoginResultEnum.OK:
> {
> FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddM
inutes(AUTH_TIMEOUT),isPersistent,userData,FormsAu thentication.FormsCookiePa
th);
> // Encrypt the ticket.
> string encTicket = FormsAuthentication.Encrypt(ticket);
> HttpCookie cookie = new
> HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
> cookie.Path = FormsAuthentication.FormsCookiePath;
> // Create the cookie.
> Response.Cookies.Add(cookie);
> // Redirect back to original URL.
> Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent));
>
> break;
> }
> }
> }
> }
>
> Regards,
> Ekta
>
Hi,
Session is still not timing out when there is no activity by the user for 15
minutes.
My web.config settings are as below.
also in the login page for the ticket I am adding 15 minutes.
What is wrong i am doing it..
Regards,
Ekta
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
uID,
System.DateTime.Now,
System.DateTime.Now.AddMinutes(15),
isPersistent,
userData,
FormsAuthentication.FormsCookiePath);
:
<?xml version="1.0" encoding="utf-8" ?
<configuration
<configSections
<section name="AppConfiguration" type="PIT.ESH.Common.WebConfiguration,
PITSHCommon" /
</configSections
<system.web
<compilation defaultLanguage="c#" debug="true" /
<customErrors mode="RemoteOnly" /
<authentication mode="Forms"
<forms loginUrl="Security/Login.aspx" protection="All" timeout="2" path="/"
/
</authentication
<authorization
<deny users="?" /
</authorization
<trace enabled="true" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" /
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="2" /
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-AU"
uiCulture = "en-AU"
/
</system.web
<AppConfiguration
<!-- Application Settings --
<add key="Web.EnablePageCache" value="true" /
<add key="Web.PageCacheExpiresInSeconds" value="3600" /
<add key="Web.EnableSsl" value="False" /
<add key="DB.ConnectionString" value="Data Source=DEVTEST-SQL1;User
ID=sa;Password=;Initial Catalog=Genesis2" /
<add key="Copyright.Message" value=" 2001-04 Positive IT Solutions Pty
Ltd." /
<add key="Copyright.EMail" value="" /
</AppConfiguration
<appSettings
<add key="Copyright.EMail" value="Etivity@.Postitive-IT.com.au" /
</appSettings
<system.runtime.remoting
<application
</application
</system.runtime.remoting
<location path="default.aspx"
<system.web
<authorization
<allow users="?" /
</authorization
</system.web
</location
<location path="Security"
<system.web
<authorization
<allow users="?" /
</authorization
</system.web
</location
<location path="Public"
<system.web
<authorization
<allow users="*" /
</authorization
</system.web
</location
</configuration
On Mon, 7 Mar 2005 17:09:01 +1100, "enahar" <enahar@.hotmail.com>
wrote:
>Hi,
>Session is still not timing out when there is no activity by the user for 15
>minutes.
>My web.config settings are as below.
>also in the login page for the ticket I am adding 15 minutes.
>
>What is wrong i am doing it..
>
>Regards,
>Ekta
Hi Etka:
Are you testing the Session timeout or the forms authentication ticket
timeout?
--
Scott
http://www.OdeToCode.com/blogs/scott/
I am writing the following code in the web.config file and the Login.aspx.cs
for the sessiopn TimeOut and for the forms authentication ticket timeout.
Also I am writing the following code in the Body tag of the Login.aspx page
<meta http-equiv="Refresh" URL="../Security/Login.aspx
even then Session is still not timing out when there is no activity by the
user for 15 minutes.What is wrong I am doing it.Please suggest.
code in the session_end is as follows:
protected void Session_End(Object sender, EventArgs e)
{
FormsAuthentication.SignOut();
if (Session["SessionID"] != null)
{
try
{
ESMSecurityModule.killSession(Session["SessionID"].ToString());
}
catch
{
}
}
}
WEB.CONFIG
<authentication mode="Forms"
<forms loginUrl="../Security/Login.aspx" protection="All" timeout="15"
path="/" /
</authentication
and for the forms authentication ticket TimeOut I am writing the following
code in the Login.aspx page:
LOGIN.ASPX PAGE
FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(15),false,userDat a,FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new
HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
cookie.Path = FormsAuthentication.FormsCookiePath;
// Create the cookie.
Response.Cookies.Add(cookie);
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent),false);
Regards,
Ekta
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:l3vo21hihtmb3pauqj9sphjqorb7v225fk@.4ax.com...
> On Mon, 7 Mar 2005 17:09:01 +1100, "enahar" <enahar@.hotmail.com>
> wrote:
>>Hi,
>>
>>Session is still not timing out when there is no activity by the user for
>>15
>>minutes.
>>
>>My web.config settings are as below.
>>also in the login page for the ticket I am adding 15 minutes.
>>
>>
>>What is wrong i am doing it..
>>
>>
>>Regards,
>>Ekta
>>
>>
> Hi Etka:
> Are you testing the Session timeout or the forms authentication ticket
> timeout?
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
Hi enahar:
Don't relay on the Session_End event. Have you tested by hitting the
site with the browser after over 15 minutes of inactivity?
--
Scott
http://www.OdeToCode.com/blogs/scott/
Yes I have tested by hitting the
site with the browser after over 15 minutes of inactivity?
Regards
Ekta
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Thread was being aborted
first time user visits that page,in the below "GetData" is a method which
gets the data from SQL Server, but some times it is taking time to get data
and throwing this error i think it has to throw "Timed Out" instead of this
"Thread Abort" error. any idea why we get this error?
Exception Type: System.Threading.ThreadAbortException
ExceptionState: System.Web.HttpApplication+CancelModuleException
Message: Thread was being aborted.
TargetSite: System.Data.DataSet GetData(RPID,
System.Data.SqlClient.SqlCommand)Unless you post the full code around where the error happens, then I can
only guess. One common cause for this error is that you have a
Response.Redirect statement enclosed within a try...catch
--
[note: if this post answers your question, you can mark it as an answer
using the web-based newsreader functions]
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"xsluser" wrote:
> Any Idea why we get this error, its happening in only one page and that too
> first time user visits that page,in the below "GetData" is a method which
> gets the data from SQL Server, but some times it is taking time to get data
> and throwing this error i think it has to throw "Timed Out" instead of this
> "Thread Abort" error. any idea why we get this error?
> Exception Type: System.Threading.ThreadAbortException
> ExceptionState: System.Web.HttpApplication+CancelModuleException
> Message: Thread was being aborted.
> TargetSite: System.Data.DataSet GetData(RPID,
> System.Data.SqlClient.SqlCommand)
By default SQL Command has 30 second to finish.
If it did not finish then it's aborted.
Look at Command.CommandTimeout value and increase it.
George.
"xsluser" <xsluser@.discussions.microsoft.com> wrote in message news:F2E4E54F-7A47-47CE-BDC9-8FBDA9A9BD3F@.microsoft.com...
Any Idea why we get this error, its happening in only one page and that too
first time user visits that page,in the below "GetData" is a method which
gets the data from SQL Server, but some times it is taking time to get data
and throwing this error i think it has to throw "Timed Out" instead of this
"Thread Abort" error. any idea why we get this error?
Exception Type: System.Threading.ThreadAbortException
ExceptionState: System.Web.HttpApplication+CancelModuleException
Message: Thread was being aborted.
TargetSite: System.Data.DataSet GetData(RPID,
System.Data.SqlClient.SqlCommand)
Thread was being aborted
first time user visits that page,in the below "GetData" is a method which
gets the data from SQL Server, but some times it is taking time to get data
and throwing this error i think it has to throw "Timed Out" instead of this
"Thread Abort" error. any idea why we get this error?
Exception Type: System.Threading.ThreadAbortException
ExceptionState: System.Web.HttpApplication+CancelModuleException
Message: Thread was being aborted.
TargetSite: System.Data.DataSet GetData(RPID,
System.Data.SqlClient.SqlCommand)Unless you post the full code around where the error happens, then I can
only guess. One common cause for this error is that you have a
Response.Redirect statement enclosed within a try...catch
[note: if this post answers your question, you can mark it as an answer
using the web-based newsreader functions]
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"xsluser" wrote:
> Any Idea why we get this error, its happening in only one page and that to
o
> first time user visits that page,in the below "GetData" is a method which
> gets the data from SQL Server, but some times it is taking time to get dat
a
> and throwing this error i think it has to throw "Timed Out" instead of thi
s
> "Thread Abort" error. any idea why we get this error?
> Exception Type: System.Threading.ThreadAbortException
> ExceptionState: System.Web.HttpApplication+CancelModuleException
> Message: Thread was being aborted.
> TargetSite: System.Data.DataSet GetData(RPID,
> System.Data.SqlClient.SqlCommand)
By default SQL Command has 30 second to finish.
If it did not finish then it's aborted.
Look at Command.CommandTimeout value and increase it.
George.
"xsluser" <xsluser@.discussions.microsoft.com> wrote in message news:F2E4E54F
-7A47-47CE-BDC9-8FBDA9A9BD3F@.microsoft.com...
Any Idea why we get this error, its happening in only one page and that too
first time user visits that page,in the below "GetData" is a method which
gets the data from SQL Server, but some times it is taking time to get data
and throwing this error i think it has to throw "Timed Out" instead of this
"Thread Abort" error. any idea why we get this error?
Exception Type: System.Threading.ThreadAbortException
ExceptionState: System.Web.HttpApplication+CancelModuleException
Message: Thread was being aborted.
TargetSite: System.Data.DataSet GetData(RPID,
System.Data.SqlClient.SqlCommand)