|
Technically session.removeAll works. Keep in mind that it's a server side call, and will erase all the session values on the web server.
Now if the browser still honors the session value, or thinks that the session value is valid, then that's a browser issue, or something else on the server is keeping the session value alive.
So you make a session in a test page, that contains a word or something, and click a button to remove all, and see if the session is erased., and play around with it.
I know that in certain modes, the session value will write a cookie on the client, with the session values. Using Firefox to examine the cookie values is useful to confirm the removal of the session value.
Chrome has alot of bugs in it, and became very bloated with code. It could just be a Chrome issue. That's out of your control, nothing you can do about it.
[EDIT]
Maybe it's the way you implemented the session, eg.
Dim m_context as httpcontext = httpcontext.current
m_context.session.add("Login", true)
if (true = m_context.session("Login") then
m_conetxt.response.redirect("admin.aspx")
End if
or perhaps the correct context was not used to create or remove the session, or the spelling of the session name does not exactly match.
Don't forget to delete your browser cache for a true test.
|
|
|
|
|
it's been several days since I am trying to resolve this issue. I have a page that is a mail inbox in the website. You can send messages to your friends from the list like on facebook.
It has AJAX code in a js file, 2 ashx files, and aspx, aspx.cs files. I was using facebox pop up when a user wanted to send a message to a friend. Now I changed the UI removed facebox and added a masterpage so that now the page is like any other page on the site. But after adding a masterpage to messages.aspx page the values of HttpContext become null after I click on send message. They are working fine when the page first loads that shows friends list and previous messages. It's when I fire a js function to save the message entered by clicking send that it's lost.
in message.aspx page I use 3 hidden fields:
<script>
function SavePostedMessage() {
var SenderAccountID = $("#hdnSenderID").val();
var ReceiverAccountID = $("#hdnReceiverID").val();
var Days = $("#hdnDays").val();
var body = GetmessageData();
if (body != null || body != "")
SaveMessageInDatabase(SenderAccountID, ReceiverAccountID, body, Days);
}
</script>
<asp:HiddenField ID="hdnSenderID" runat="server" />
<asp:HiddenField ID="hdnReceiverID" runat="server" />
<asp:HiddenField ID="hdnDays" runat="server" />
<a style="cursor: pointer;" onclick="SavePostedMessage()">
<div style="height: 25px; width: 85px; float: left; margin-top: 28px; padding-top: 5px;
background: #01B2E5; text-align: center;" id="uploadifyContainer"> Send
In messages.aspx.cs I put in page_load the code to register a js function: ScriptManager.RegisterStartupScript(this, typeof(string), "Play", "javascript:GetMessageConversation('" + Request.QueryString["AccountID"] + "','" + _userSession.CurrentUser.AccountID + "','7');", true);
In Ajax.js I defined function GetMessageConversation(SenderAccountID, ReceiverAccountID, Days) {
$("#hdnSenderID").val(SenderAccountID);
$("#hdnReceiverID").val(ReceiverAccountID);
$("#hdnDays").val(Days);
$("#divPostComment").show();
setSelected("trUser" + ReceiverAccountID);
$.ajax({
type: "POST",
url: "/MessageFacebox/GetMessageConversation.ashx",
data: 'SenderAccountID=' + SenderAccountID + "&ReceiverAccountID=" + ReceiverAccountID + "&Days=" + Days,
success: function (data) {
$('#messageconversationdata').html(data);
Scrollbottom();
},
error: function (errordata) {
alert('Sorry some error occurred');
}
});
}
function SaveMessageInDatabase(SenderAccountID, ReceiverAccountID, Body, days) {
$.ajax({
type: "POST",
url: "/MessageFacebox/SaveMessage.ashx",
data: 'SenderID=' + SenderAccountID + "&ReceiverID=" + ReceiverAccountID + "&Body=" + Body,
success: function (data) {
GetMessageConversation(SenderAccountID, ReceiverAccountID, days);
},
error: function () {
alert('Sorry some error occurred');
}
});
In GetMessageConversation.ashx context.Request.Form["SenderAccountID"] and context.Request.Form["ReceiverAccountID"] return stored values
Account senderAccount = _accountRepository.GetAccountByAccountID(Convert.ToInt32(context.Request.Form["SenderAccountID"]));
Account receiverAccount = _accountRepository.GetAccountByAccountID(Convert.ToInt32(context.Request.Form["ReceiverAccountID"]));
But in SaveMessage.ashx Account senderAccount = _accountRepository.GetAccountByAccountID(Convert.ToInt32(context.Request.Form["SenderID"])) ; Account receiverAccount = _accountRepository.GetAccountByAccountID(Convert.ToInt32(context.Request.Form["ReceiverID"] ));
context.Request.Form["SenderID"] and context.Request.Form["ReceiverID"] have null values.
the first one loads when the page is first accessed. The save function is called when user enters a message and click on send button in messages.aspx
All works fine without a master page. Once I add masterpage file to messages.aspx the code stops working.
Thanks in advance.
|
|
|
|
|
Did you test your data before transmuting, so you can isolate the problem between the client or server side?
alert('SenderAccountID=' + SenderAccountID + "&ReceiverAccountID=" + ReceiverAccountID + "&Days=" + Days,);
When changing to a masterpage, the id's change on the textboxes and labels, so a Ct100 is added as a prefix to the id of the element.
so you can change the id mode of the control to static, or change the way jquery finds the element to a wildcard prefix and then the id name.
|
|
|
|
|
Thanks for responding. That was the issue.
|
|
|
|
|
Hi All
I am facing one issue while downloading .xls file in my report page.I am describing the details below
Issue:
--> I am displaying some companies details in report page as table rows and columns like “<table><tr><td>company name……”
--> In report page I am having Download button ,when click on download button my companies details table data need to be download as .xls(Excel) file.
--> when clicking on download button its showing one alert box with following message "The file you are trying to open,XXXX,is in different format than specified by the file extension.Verify that the file is not corrupted and is from a trusted source before opening the file"
--> The below code I written for downloading file in my page.
Var outputhtml="";
outputhtml +="";
outputhtml +="";
outputhtml +="";
outputhtml +="";
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader( "Content-disposition","attachment; filename=My Company Details.xls");
Response.write(outputhtml);
Please help me to solve this issue.
Thanks in advance.
modified 14-Jul-13 21:48pm.
|
|
|
|
|
That could be a message from Excel. When you saved data in the new format and use the extension .xls instead of .xlsx, Excel will warn you. And similar the other way round. So just try
Response.AddHeader( "Content-disposition","attachment; filename=My Company Details.xlsx");
and make sure your Excel file is correctly named.
|
|
|
|
|
Hi,
I am beginning with asp.net and I have downloaded the following: VS Express 2012 (with asp.net 4.5 ) and sql server express from www.asp.net/downloads
I want to download some simple asp.net (c#) projects which will give me a basic understanding of the fundamentals of asp.net. e.g simple tricks and tips to do tasks in asp.net. Please advice.
Thanks !
|
|
|
|
|
|
Hi,
I need to export file in xlsx format. My code is bellow:
string Path = strFullTo + "Balancing_" + String.Format("{0:MMddyy}", DateTime.Now) + ".xlsx";
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter);
GridView DataGrd = new GridView();
System.IO.StreamWriter vw = new System.IO.StreamWriter(Path, true,System.Text.Encoding.Default);
stringWriter.ToString().Normalize();
string style = @" .textmode { mso-number-format:\@; } ";
vw.Write(style);
vw.Write(stringWriter.ToString());
vw.Flush();
vw.Close();
But my problem is when I am trying to open the xlsx file it is saying "File format or extension is not valid".
I need to keep the data in xlsx file. Please help.
Thanks & Regards
Mishra
|
|
|
|
|
You need to export as .xls instead of .xlsx. .xlsx is more of an xml format but .xls can support html format, which is essentially what you are doing.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have created a treeview, which is binding categories and subcategories from database.
I want to display an icon (image) on left side of the treeview. For example, in treeview I have categories such as amana tool as a parent node and the router bits as child node of amana tool. So, in database I have icon of amana tool as well as icon of router bits. Now, I am able to show categories (amana tool) only in treeview. But, I need that left side should show the icon of the related categories and then categories name(amana tool).
Note: The icon should bind from database but it should not be static icon because I need to show more than 100 categories and the icon existing in database.
Please help me out.
Here my code works correctly , further what i have to do?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace ShopGear1.View
{
public partial class treefin : System.Web.UI.Page
{
private string scon = "";
protected void Page_Load(object sender, EventArgs e)
{
scon = " connection string";
ModuleTreeView.CollapseAll();
FillTreeView();
}
public DataTable GetModuleDetails()
{
using (SqlConnection conn = new SqlConnection(scon))
{
string sql = "sql query";
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}
public void FillTreeView()
{
DataTable modules = new DataTable();
modules = GetModuleDetails();
ModuleTreeView.Nodes.Clear();
PopulateTreeNode(modules, null, 0);
}
private void PopulateTreeNode(DataTable modulelist, TreeNode parent, int parentid)
{
TreeNodeCollection baseNodes;
TreeNode node;
if (parent == null)
{
baseNodes = ModuleTreeView.Nodes;
}
else
{
baseNodes = parent.ChildNodes;
}
foreach (DataRow dtrow in modulelist.Rows)
{
if (int.Parse(dtrow["parent_orid"].ToString()) == parentid)
{
node = new TreeNode();
node.Text = dtrow["descript"].ToString();
node.Value = dtrow["code_webcategory_id"].ToString();
node.SelectAction = TreeNodeSelectAction.Select;
baseNodes.Add(node);
PopulateTreeNode(modulelist, node, int.Parse(dtrow["code_webcategory_id"].ToString()));
}
}
ModuleTreeView.CollapseAll();
}
}
}
|
|
|
|
|
I had to program the ParentNodeStyle.ImageUrl = "The Image Path"
This is a treeview I made for ckEditor, it's all code in vb, but you should get the idea. It was created on Protected Sub OnInit().
As you create more nodes, just add the new image url
tv_FileBrowser_Content_Navigation = New TreeView
With tv_FileBrowser_Content_Navigation
.ID = [ID] & "_tv_FileBrowser_Content_Navigation"
.Style.Add(HtmlTextWriterStyle.Width, "90%")
.Style.Add(HtmlTextWriterStyle.PaddingTop, "25px")
.ExpandDepth = 10
.ImageSet = TreeViewImageSet.XPFileExplorer
.NodeIndent = 10
.ShowLines = True
.ShowExpandCollapse = True
.PathSeparator = Convert.ToChar("/")
.NodeStyle.ForeColor = Drawing.Color.Black
.NodeStyle.HorizontalPadding = 6
.NodeStyle.VerticalPadding = 0
.NodeStyle.NodeSpacing = 0
.RootNodeStyle.HorizontalPadding = 6
.ParentNodeStyle.ImageUrl = cs.GetWebResourceUrl(rsType, "Admin_PM_Standard.folder_0.png")
.ParentNodeStyle.HorizontalPadding = 6
.SelectedNodeStyle.ForeColor = Drawing.Color.Black
.SelectedNodeStyle.BackColor = Drawing.Color.LightGray
.SelectedNodeStyle.Font.Underline = False
.SelectedNodeStyle.HorizontalPadding = 6
.SelectedNodeStyle.VerticalPadding = 0
.HoverNodeStyle.Font.Underline = True
.HoverNodeStyle.ForeColor = Drawing.Color.Black
.HoverNodeStyle.BackColor = Drawing.Color.LightGray
node_Editor = New TreeNode("File Browser")
node_Editor.Selected = True
node_Editor.SelectAction = TreeNodeSelectAction.Expand
node_Editor.Text = "File Browser"
node_Editor.Value = "/Product/editor"
node_Editor.ImageUrl = cs.GetWebResourceUrl(rsType, "Admin_PM_Standard.myComputer.png")
.Nodes.Add(node_Editor)
'########################################################
'
node_Files = New TreeNode("files")
node_Files.CollapseAll()
node_Files.Selected = False
node_Files.SelectAction = TreeNodeSelectAction.Expand
node_Files.Text = "files"
node_Files.Value = "files"
node_Files.ImageUrl = cs.GetWebResourceUrl(rsType, "Admin_PM_Standard.folder_0.png")
node_Editor.ChildNodes.Add(node_Files)
'########################################################
'
node_Flash = New TreeNode("flash")
node_Flash.CollapseAll()
node_Flash.Selected = False
node_Flash.SelectAction = TreeNodeSelectAction.Expand
node_Flash.Text = "flash"
node_Flash.Value = "flash"
node_Flash.ImageUrl = cs.GetWebResourceUrl(rsType, "Admin_PM_Standard.folder_0.png")
node_Editor.ChildNodes.Add(node_Flash)
'########################################################
'
node_Images = New TreeNode("images")
node_Images.CollapseAll()
node_Images.Selected = False
node_Images.SelectAction = TreeNodeSelectAction.Expand
node_Images.Text = "images"
node_Images.Value = "images"
node_Images.ImageUrl = cs.GetWebResourceUrl(rsType, "Admin_PM_Standard.folder_0.png")
node_Editor.ChildNodes.Add(node_Images)
'########################################################
'Context Menu's
'########################################################
AddHandler .SelectedNodeChanged, AddressOf tv_FileBrowser_Content_Navigation_SelectedNodeChanged
AddHandler .TreeNodeExpanded, AddressOf tv_FileBrowser_Content_Navigation_TreeNodeExpanded
AddHandler .TreeNodeCollapsed, AddressOf tv_FileBrowser_Content_Navigation_TreeNodeCollapsed
End With
panel_FileBrowser_Content_TreeView.Controls.Add(tv_FileBrowser_Content_Navigation)
As you create each addtional node, you add the image url.
I know you can use an embedded image, but not sure how to use a database blob.
[edit]
I only created the first level nodes in the initial treeview. The child nodes are populated on demand, when a parent node is expanded, so an event handler was added to detect expand node, and upon expansion, the child nodes are added according to the parent node type or name.
I had load time issues on the first couple of tries, and had to speed it up a bit.
|
|
|
|
|
I am developing a web application, which have to get the data from selected Excel file and save it in SQL Database.
I want to select Excel File in runtime using the FileUpload control. Is this possible..? Please guide me..
|
|
|
|
|
hi SravanKumar-A,
yes it's possible....
first, his first save the file when uploaded, this means stored on the Server side, here you set it to accommodate PathLocation Files uploaded the results ..
then, you read his file based PathLocation excel file it in the store ..
how to read the contents of the data from the Excel file, you can googling, a lot of his examples ..
You must read the contents of his excel how many rows,
then you loop through the contents of each row to get her,
then you input into a database row-a row ..
after that you delete the file upload it if you save the file you do not use anymore ..
yes, this is just a logical course to determine the appropriate code logic what its like ..
|
|
|
|
|
previously we worked on Google calendar Version 2 but now we want to convert it to Google calendar version 3. If any one has worked on Google calendar version 3. Kindly send me a small project over it otherwise send me some details of migrating it to version 3.
The problem that i am facing is in verison 2, we use EventFeed, EventQuery, CalendarQuery, CalendarFeed so here i am getting the problem.
|
|
|
|
|
|
ya i go through the Google calendar Migration doc, it helps but they didn't explain anything on what to do with EventFeed, EventQuery, CalendarFeed, CalendarQuery
|
|
|
|
|
I am facing below issue during the web site execution. Kindly help me how to resolve this issue.
Client found response content type of 'multipart/related; boundary=MIMEBoundaryurn_uuid_4031DA6F87A35F03091373531842143; type="text/xml"; start="<0.urn:uuid:4031DA6F87A35F03091373531842144@apache.org>"', but expected 'text/xml'. The request failed with the error message: -- --MIMEBoundaryurn_uuid_4031DA6F87A35F03091373531842143 Content-Type: text/xml; charset=utf-8 Content-Transfer-Encoding: 8bit Content-ID: <0.urn:uuid:4031DA6F87A35F03091373531842144@apache.org> 03903Business PostpaidContactfalse<title>MrMBSESEseMB SE SEMale15sfkssljfkslskjdfkAabaN/ALebanonNorth LebanonKouraN/A1231980-01-01LebaneseCitizenArabicPhonefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalse2002011-01-01T00:00:00.0Z9999-12-30T23:59:59.0ZfalseMB SE SEBusiness PostpaidAdministrationfalseB0000040238B0000040238D00000402380-0.05truefalseActiveManually Created2011-01-01T00:00:00.0Z2011-04-01T09:38:22.0Z2011-01-01T00:00:00.0Z00015sfkssljfkslskjdfkAabaN/ALebanonNorth LebanonKouraN/A??????????XML Format 1Customer's Invoice Addressfalsefalsetruefalse231_TestSchTesting ScheduleTaxableInvoicefalsefalsefalsetrueMedium Risk - Cash & DD4AVOC8PRC04falsefalse008320Cash at POSHome0 --MIMEBoundaryurn_uuid_4031DA6F87A35F03091373531842143-- --.
dadsadasd
|
|
|
|
|
Please do not repost the same issue; if anyone knows the answer they will respond in their own time. Please delete the duplicate, and if you have any further information, edit the above post.
Use the best guess
|
|
|
|
|
asv wrote: <Title>Mr</Title>MBSESEseMB SE SEMale15sfkssljfkslskjdfkAabaN/ALebanonNorth
Did you transmit this?, or did you receive this?
In the quote above, the 2nd XML field corrupted, probably because you did not encode the entire package before transmitting to the server. I suspect you may have international chars in the values.
The server was looking for UTF-8 encoding, but I'm not sure what the package looked like before you transmitted it, or what the response is suppose to look like as well.
You may of transmitted garbage to the server when making your web request, and received back garbage as an error. If the web service was well written, in which I don't know, then you should of got back a clean XML Text of the error.
[FYI]
Looking at the data, I remember a post several months ago from an OP that was working with airline ticket data, looks similar to yours, but the data was packaged as a delimited char array, and was not XML or WSDL. I see the same data structure in the posted code dump that I saw in that OPs post.
If your the same guy or gal, so you probably explain what your up to here, so we can get a better idea of how to help you.
[edit]
asv wrote: A1231980-01-01LebaneseCitizenArabicPhonefalsefalsefalsefalsefalsefals
This is the delimited text in the code file I saw months ago.
|
|
|
|
|
I am executing the API and throwing a below error. kindly help me on this.
API Response in Web Browser:
Calling Customer Details Fetch
API call is failed Client found response content type of 'multipart/related; boundary=MIMEBoundaryurn_uuid_F88BEACD3D34947E3A1373490867796; type="text/xml"; start="<0.urn:uuid:F88BEACD3D34947E3A1373490867797@apache.org>"', but expected 'text/xml'. The request failed with the error message: -- --MIMEBoundaryurn_uuid_F88BEACD3D34947E3A1373490867796 Content-Type: text/xml; charset=utf-8 Content-Transfer-Encoding: 8bit Content-ID: <0.urn:uuid:F88BEACD3D34947E3A1373490867797@apache.org> 03903Business PostpaidContactfalseMBSESEseMB SE SEMale15sfkssljfkslskjdfkAabaN/ALebanonNorth LebanonKouraN/A1231980-01-01LebaneseCitizenArabicPhonefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalse2002011-01-01T00:00:00.0Z9999-12-30T23:59:59.0ZfalseMB SE SEBusiness PostpaidAdministrationfalseB0000040238B0000040238D00000402380-0.05truefalseActiveManually Created2011-01-01T00:00:00.0Z2011-04-01T09:38:22.0Z2011-01-01T00:00:00.0Z00015sfkssljfkslskjdfkAabaN/ALebanonNorth LebanonKouraN/A??????????XML Format 1Customer's Invoice Addressfalsefalsetruefalse231_TestSchTesting ScheduleTaxableInvoicefalsefalsefalsetrueMedium Risk - Cash & DD4AVOC8PRC04falsefalse008320Cash at POSHome0 --MIMEBoundaryurn_uuid_F88BEACD3D34947E3A1373490867796-- --.
dadsadasd
|
|
|
|
|
This looks like a call to a web service using XML, but is really a server that splits out delinted text. There is a char value missing that seperates each field that is not showing above.
You simply don't understand what your working with here.
It's a fixed response. It's always let's say, 80 items, always in the same position. Kind of like a floppy disk, which is divided into 80 sectors. But I digress,
1 - 03903
2 - Business
3 - Post
4 - Paid
5 - Contact
and so forth until the end
So you figure how to just request the response, decode the response, and split the value into an array string or list or something, then you can access each value by number, so if you want value 1, you look for response(1)
Maybe somebody else can expand or help out further.
|
|
|
|
|
Info Created - packages/MSBuildTasks.1.4.0.61/tools/Install.ps1
Info Creating backup of previous version - packages/MSBuildTasks.1.4.0.61/tools\MSBuild.Community.Tasks.dll
Failure Installation Failed - ResourceFile
Info Rolling back component install - Script
Info Restored backup of previous version - Providers\DataProviders\SqlDataProvider\00.00.01.SqlDataProvider
Info Restored backup of previous version - Providers\DataProviders\SqlDataProvider\Uninstall.SqlDataProvider
Info Component rolled back successfully - Script
Info Installation Failed - task
Info Deleted temporary install folder
EndJob Installation Failed
|
|
|
|
|
I would recommend going to their support/forum to ask.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
hi, friends,
I am developing the web app for touch device.
I have the gridview inside the DIV, showing the list of data.
if I used the scrollbars for this div, it is no good to scroll by touching on touch device.
I want to scroll up/down on the gridview content like the swiping.
because, the users will try to swipe the DIV by touching rather than scrolling on the scrollbar.
how can I achieve?
|
|
|
|
|