|
Not sure how to do the session.abandon and where exactly.
|
|
|
|
|
use this
Session["Username"] = "";
or
Session["Username"].Abondon();
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hello,
I think this is an easier way by placing it in the web.config accordingly
<location path="AddCodes.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
modified on Monday, January 11, 2010 10:03 AM
|
|
|
|
|
Have something like this:
1. Successful login, set a session variable with the username.
2. On logout link click, set that session variable as -1 and redirect to login page.
3. Set the default value of that session variable as -1 and place a check in all the pages that if that variable is -1, redirect to login page.
PS: Not an ASP.Net developer so there might be far better ways of doing this.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
|
using Session, when login, Session["Username"]="##",
when logout, Session["Username"] = "".
You can check whether Session["Username"] is null to see if the user logged in or not. If Session["Username"]=="", the user didn't log in.
|
|
|
|
|
Hi All,
on clicking on link button(inside datagrid) i got this error
"System.Web.HttpException: The state information is invalid for this page and might be corrupted."
Source Error:
[No relevant source lines]
Don't know why this error ocur, if any one know then please help me
Thanks
prabhakar dwivedi
|
|
|
|
|
Can we see the Gridview Defination. Show us the markup
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thanks below are the complete deatils of error
I allready clean the asp.net Temporary files.
No relevant source lines]
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\opensearch\71fa1e73\e4433ca6\App_Web_ezvhodyz.2.cs Line: 0
Stack Trace:
[FormatException: Invalid character in a Base-64 string.]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +113
[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port: 7073
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.3; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)
ViewState: /wEPDwUKLTg0MjY3NDI4MA9kFgICAQ9kFgQCDQ88KwALAQAPFg4eC18hSXRlbUNvdW50AgMeCERhdGFLZXlzFgAeCFBhZ2VTaXplAgoeCVBhZ2VDb3VudAIBHhVfIURhdGFTb3VyY2VJdGVtQ291bnQCAx4QVmlydHVhbEl0ZW1Db3VudAIDHhBDdXJyZW50UGFnZUluZGV4ZmQWAmYPZBYGAgIPZBYCZg9kFgYCAQ8PFgYeBFRleHQFEyBUZXN0UG9ydGFsID4gSG9tZSAeD0NvbW1hbmRBcmd1bWVudAWLAWh0dHA6Ly9sb2NhbGhvc3QvT3BlblNlYXJjaC9IaWdobGlnaHRlci5hc3B4P0RvY0lkPTIwJkluZGV4PWMlM2ElNWNpbmV0cHViJTVjd3d3cm9vdCU1Y09wZW5TZWFyY2glNWNkdFNlYXJjaCU1Y0ROTlNpdGUxJkhpdENvdW50PTEmaGl0cz0yMCseC0NvbW1hbmROYW1lBV5Eb2NJZD0yMCZJbmRleD1jJTNhJTVjaW5ldHB1YiU1Y3d3d3Jvb3QlNWNPcGVuU2VhcmNoJTVjZHRTZWFyY2glNWNETk5TaXRlMSZIaXRDb3VudD0xJmhpdHM9MjArZGQCAg8VAZwBLi4ua25vd2xlZGdlIEludGVyYWN0IGFuZCBlbmdhZ2Ugd2l0aCBvdGhlciBtZW1iZXJzIG9mIHRoZSBEb3ROZXROdWtlIDxiPmNvbW11bml0eTwvYj4gJiM4M...]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14
System.Web.UI.HiddenFieldPageStatePersister.Load() +217
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
System.Web.UI.Page.LoadAllState() +43
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.dtadvancesearch_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\opensearch\71fa1e73\e4433ca6\App_Web_ezvhodyz.2.cs
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
help me
Thanks
prabhakar dwivedi
|
|
|
|
|
Good Day All
i have a Telerik Grid , i think the idea is the same as Normal asp.net grid. its Defined like this
<telerik:RadGrid ID="RagCategories" runat="server" Height="399px" Width="698px" AutoGenerateColumns="False" Skin="Sunset" OnDataBound="RagCategories_DataBound">
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<Columns>
<telerik:GridTemplateColumn DataField="CategoryID" HeaderText="ID" UniqueName="TemplateColumn">
<ItemTemplate>
<asp:Label ID="lblID" Font-Bold="true" runat="server" Text='<%# Eval("CategoryID")%>' ></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Forum Categories" UniqueName="TemplateColumn1">
<ItemTemplate>
<asp:HyperLink id="link1" Text='<%# Eval("CATEGORYNAME")%>' NavigateUrl='<%# Eval("[LINK]")%>' runat="server" > </asp:HyperLink>
<asp:Label ID="descr" runat="server" Text='<%# Eval("Description")%>'></asp:Label>
</ItemTemplate><HeaderStyle Font-Bold="True">
</HeaderStyle>
</telerik:GridTemplateColumn>
</Columns>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
</MasterTableView>
<FilterMenu EnableTheming="True" Skin="Sunset">
<CollapseAnimation Type="OutQuint" Duration="200">
</CollapseAnimation>
</FilterMenu>
<ClientSettings>
<ClientEvents OnRowClick="OnClientClick="javascript: return SetHidSelectedRows()"" />
</ClientSettings>
</telerik:RadGrid>
in this Grid there is "CategoryID" and on RowDatabound event i hide this Column and it working. now in this Grid i have this
<asp:HyperLink id="link1" Text='<%# Eval("CATEGORYNAME")%>' NavigateUrl='<%# Eval("[LINK]")%>' runat="server" > </asp:HyperLink>
as shown above,when my user clicks the Hyperlink in the Grid, this will take the user to the Appropriate Page,its Good , and i want to save the "CategoryID" of the select Hyperlink.
Thank you
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hai all
i need to move row move rows up or down within the Ultraweb grid on the client side.can any one help me i am using infragistics 2009 vol.2
Thanks.
|
|
|
|
|
What do you mean move up and Down. Please Explain Clearly. i use Infragistics all the time.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
For example if I select the third row of the grid and on clicking the up arrow the third row should move to the second row and the data in the second row should move to the third.
thank you
|
|
|
|
|
Suppose I am having html and in that images tags are used I want to read that tags and get the src i.e file name until the image tag is finished.
|
|
|
|
|
Why would you want to read your HTML tags through code? Are you trying screen scrapping by doing HTML parsing?
In that case you have to identify the starting of an image tag using <img then look for the nearest src tag property and then look for quotes ["]
Is there any other way, yes you have to define a good regular expression to parse for patterns but that would be too much work, but definitely possible and efficient.
|
|
|
|
|
Hi, I have an asp.net web application. I have an excel sheet and I have to export that excel sheet to a pdf file. I have done it, but still facing some problems.
1. Whenever I do export, its open excel file. I do not want to open the excel file.
2. I have to convert the pdf file to landscape.
Here is the code
private void ExportExcelToPDF()
{
string sourceFilePath = Server.MapPath("~/aaa.xlsx");
string destinationFilePath = Server.MapPath("~/aaa.pdf");
Microsoft.Office.Interop.Excel.Application myExcelApp;
Microsoft.Office.Interop.Excel.Workbooks myExcelWorkbooks = null;
Microsoft.Office.Interop.Excel.Workbook myExcelWorkbook = null;
try
{
object misValue = System.Reflection.Missing.Value;
myExcelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
myExcelApp.Visible = true;
object varMissing = Type.Missing;
myExcelWorkbooks = myExcelApp.Workbooks;
if (System.IO.File.Exists(destinationFilePath))
{
System.IO.File.Delete(destinationFilePath);
}
myExcelWorkbook = myExcelWorkbooks.Open(sourceFilePath, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
myExcelWorkbook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF,
destinationFilePath, Microsoft.Office.Interop.Excel.XlFixedFormatQuality.xlQualityStandard,
varMissing, false, varMissing, varMissing, false, varMissing);
myExcelWorkbooks.Close();
myExcelApp.Quit();
}
catch
{
}
finally
{
myExcelApp = null;
}
}
Pankaj
|
|
|
|
|
Pankaj Saha wrote: 1. Whenever I do export, its open excel file. I do not want to open the excel file.
I got the solution for this. Actually I did not see that little important thing.
myExcelApp.Visible = false;
now excel file is not opening.
Now need the solution for the second problem.
Pankaj
|
|
|
|
|
i get the value f my field. it is contain ""
my code is this form:
drMyRow["reqDesc"] = item["xxx"].ToString();
after that drMyRow["reqDesc"] = hi
now i want dont show
what do i do
i want show drMyRow["reqDesc"] = hi
modified on Monday, January 11, 2010 5:08 AM
|
|
|
|
|
hii am trying to send email using smtp.net.mail namespace.
I have written the appropriate code for it in vb.net bu t am getting following error.
"No connection could be made because the target machine actively refused it (ip address)"
what shud i do....plz guide../
|
|
|
|
|
can we see the code ?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
i have written the following code:
Dim message As MailMessage = New MailMessage()
message.From = New MailAddress("xyz@jmfinfotech.com")
message.To.Add(New MailAddress("xyz@gmail.com"))
message.Subject = "Yous Selection:"
message.Body = "You have selected following options:" + txtselection.Text
Dim client As SmtpClient = New SmtpClient()
client.Send(message)
and web config code:
<system.net>
<mailSettings >
<smtp>
<network host="smtp.1and1.com" port="25" userName="xyx" password="123" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
but getting error:target machine actively refused (ipaddress).tell me what to do plz guide...
|
|
|
|
|
mylogics wrote: smtp.1and1.com
may not be running or if it is running the port might not be correct. Please check with your Email Administrator/Helpdesk for more assistance.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hi all,
I have a Gridview that I populate with values from textboxes. These populated values doesn't have any ID. I can edit and update records but I don't know how to delete records. Please advice on how I can achieve this.
P.S: These records are NOT being saved on the database, only on the Gridview.
I'll appreciate any help I can get.
Thanks.
|
|
|
|
|
What is the datastore that you use to populate the gridview. If you can share the logic that you use for edit then we can avoid reinventing the wheel.
|
|
|
|
|
I'm using dataTable as staorage and then I save it in a Session. Here is the code.
private void DataBindGrid()
{
try
{
string checkflag;
//Create DataTable.
DataTable dt = (DataTable)Session["dtInfoProfile"];
if (dt == null)
{
//Create DataTable.
dt = new DataTable();
//Assign Columns to it.
dt.Columns.Add(new DataColumn("Full Names"));
dt.Columns.Add(new DataColumn("Type"));
dt.Columns.Add(new DataColumn("Identifying Number"));
dt.Columns.Add(new DataColumn("Passport Number"));
}
//Create a DataRow by dt.NewRow().
DataRow dr = dt.NewRow();
if (rdbIndividual.Checked)
{
//Fill that row and add it to datatable.
checkflag = rdbIndividual.Text;
dr["Full Names"] = IndividualDetailsControl.FirstName + " " + IndividualDetailsControl.LastName;
dr["Type"] = checkflag;
dr["Identifying Number"] = IndividualDetailsControl.IdentityNo;
dr["Passport Number"] = IndividualDetailsControl.PassportNo;
dt.Rows.Add(dr);
}
else if (rdbTrust.Checked)
{
checkflag = rdbTrust.Text;
//Fill that row and add it to datatable.
dr["Full Names"] = EntityDetailsControl.Name;
dr["Type"] = checkflag;
dr["Identifying Number"] = EntityDetailsControl.RegistrationNo;
dt.Rows.Add(dr);
}
else
{
checkflag = rdbEntity.Text;
//Fill that row and add it to datatable.
dr["Full Names"] = EntityDetailsControl.Name;
dr["Type"] = checkflag;
dr["Identifying Number"] = EntityDetailsControl.RegistrationNo;
dt.Rows.Add(dr);
}
Session["dtInfoProfile"] = dt;
//Bind GridView Here with this Table
this.BindData();
//Rename the button
btnAdd.Text = "Add New";
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
private void BindData()
{
dgInfoProfile.DataSource = Session["dtInfoProfile"];
dgInfoProfile.DataBind();
}
For Edit and Update:
//Edit
protected void dgInfoProfile_RowEditing(object sender, GridViewEditEventArgs e)
{
//Set the edit index.
dgInfoProfile.EditIndex = e.NewEditIndex;
//Bind data to the GridView control.
this.BindData();
}
//Update
protected void dgInfoProfile_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//Retrieve the table from the session object.
DataTable dt = (DataTable)Session["dtInfoProfile"];
//Update the values.
GridViewRow row = dgInfoProfile.Rows[e.RowIndex];
dt.Rows[row.DataItemIndex]["Full Names"] = ((TextBox)(row.Cells[1].Controls[0])).Text;
dt.Rows[row.DataItemIndex]["Type"] = ((TextBox)(row.Cells[2].Controls[0])).Text;
dt.Rows[row.DataItemIndex]["Identifying Number"] = ((TextBox)(row.Cells[3].Controls[0])).Text;
dt.Rows[row.DataItemIndex]["Passport Number"] = ((TextBox)(row.Cells[4].Controls[0])).Text;
//Reset the edit index.
dgInfoProfile.EditIndex = -1;
//Bind data to the GridView control.
this.BindData();
}
|
|
|
|